SDL API renaming: SDL_gamecontroller.h
SDL_gamecontroller.h has been renamed SDL_gamepad.h, and all APIs have been renamed to match. Fixes https://github.com/libsdl-org/SDL/issues/6885
This commit is contained in:
parent
ab0c5cf07d
commit
659abc721a
20
.gitignore
vendored
20
.gitignore
vendored
@ -61,17 +61,17 @@ Release
|
||||
*.ncb
|
||||
*.suo
|
||||
*.sdf
|
||||
VisualC/tests/controllermap/axis.bmp
|
||||
VisualC/tests/controllermap/button.bmp
|
||||
VisualC/tests/controllermap/controllermap.bmp
|
||||
VisualC/tests/controllermap/controllermap_back.bmp
|
||||
VisualC/tests/gamepadmap/axis.bmp
|
||||
VisualC/tests/gamepadmap/button.bmp
|
||||
VisualC/tests/gamepadmap/gamepadmap.bmp
|
||||
VisualC/tests/gamepadmap/gamepadmap_back.bmp
|
||||
VisualC/tests/loopwave/sample.wav
|
||||
VisualC/tests/testautomation/CompareSurfaces0001_Reference.bmp
|
||||
VisualC/tests/testautomation/CompareSurfaces0001_TestOutput.bmp
|
||||
VisualC/tests/testgamecontroller/axis.bmp
|
||||
VisualC/tests/testgamecontroller/button.bmp
|
||||
VisualC/tests/testgamecontroller/controllermap.bmp
|
||||
VisualC/tests/testgamecontroller/controllermap_back.bmp
|
||||
VisualC/tests/testgamepad/axis.bmp
|
||||
VisualC/tests/testgamepad/button.bmp
|
||||
VisualC/tests/testgamepad/gamepadmap.bmp
|
||||
VisualC/tests/testgamepad/gamepadmap_back.bmp
|
||||
VisualC/tests/testoverlay2/moose.dat
|
||||
VisualC/tests/testrendertarget/icon.bmp
|
||||
VisualC/tests/testrendertarget/sample.bmp
|
||||
@ -87,7 +87,7 @@ android-project/.gradle/
|
||||
|
||||
test/checkkeys
|
||||
test/checkkeysthreads
|
||||
test/controllermap
|
||||
test/gamepadmap
|
||||
test/loopwave
|
||||
test/loopwavequeue
|
||||
test/testatomic
|
||||
@ -105,7 +105,7 @@ test/testerror
|
||||
test/testevdev
|
||||
test/testfile
|
||||
test/testfilesystem
|
||||
test/testgamecontroller
|
||||
test/testgamepad
|
||||
test/testgeometry
|
||||
test/testgesture
|
||||
test/testgl2
|
||||
|
@ -10,7 +10,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsp
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3_test", "SDL_test\SDL_test.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamecontroller", "tests\testgamecontroller\testgamecontroller.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08305}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamepad", "tests\testgamepad\testgamepad.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08305}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgdk", "tests\testgdk\testgdk.vcxproj", "{1C9A3F71-35A5-4C56-B292-F4375B3C3649}"
|
||||
EndProject
|
||||
|
@ -304,7 +304,7 @@
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_error.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_events.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_filesystem.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_gamecontroller.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_gamepad.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_guid.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_haptic.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_hints.h" />
|
||||
@ -403,7 +403,7 @@
|
||||
<ClInclude Include="..\..\src\joystick\controller_type.h" />
|
||||
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
|
||||
<ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h" />
|
||||
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h" />
|
||||
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
|
||||
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
|
||||
<ClInclude Include="..\..\src\joystick\usb_ids.h" />
|
||||
@ -622,7 +622,7 @@
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360w.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
|
||||
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
|
||||
<ClCompile Include="..\..\src\joystick\SDL_gamepad.c" />
|
||||
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
|
||||
<ClCompile Include="..\..\src\joystick\virtual\SDL_virtualjoystick.c" />
|
||||
<ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c" />
|
||||
|
@ -222,7 +222,7 @@
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_filesystem.h">
|
||||
<Filter>API Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_gamecontroller.h">
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_gamepad.h">
|
||||
<Filter>API Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_guid.h">
|
||||
@ -483,7 +483,7 @@
|
||||
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h">
|
||||
<Filter>haptic</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h">
|
||||
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h">
|
||||
<Filter>joystick</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h">
|
||||
@ -916,7 +916,7 @@
|
||||
<ClCompile Include="..\..\src\joystick\controller_type.c">
|
||||
<Filter>joystick</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c">
|
||||
<ClCompile Include="..\..\src\joystick\SDL_gamepad.c">
|
||||
<Filter>joystick</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\SDL_joystick.c">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Package>
|
||||
<Chunk Id="1000" Marker="Launch">
|
||||
<FileGroup DestinationPath="." SourcePath="." Include="testgamecontroller.exe" />
|
||||
<FileGroup DestinationPath="." SourcePath="." Include="testgamepad.exe" />
|
||||
<FileGroup DestinationPath="." SourcePath="." Include="MicrosoftGame.config" />
|
||||
<FileGroup DestinationPath="." SourcePath="." Include="*.bmp" />
|
||||
<FileGroup DestinationPath="." SourcePath="." Include="*.png" />
|
@ -28,7 +28,7 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{55812185-D13C-4022-9C81-32E0F4A08305}</ProjectGuid>
|
||||
<RootNamespace>testgamecontroller</RootNamespace>
|
||||
<RootNamespace>testgamepad</RootNamespace>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
@ -124,7 +124,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TypeLibraryName>.\Release/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Release/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -147,7 +147,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TypeLibraryName>.\Release/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Release/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -170,7 +170,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TypeLibraryName>.\Release/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Release/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -193,7 +193,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TypeLibraryName>.\Debug/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Debug/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@ -219,7 +219,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TypeLibraryName>.\Debug/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Debug/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@ -245,7 +245,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TypeLibraryName>.\Debug/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Debug/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@ -327,7 +327,7 @@
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="..\..\..\test\controllermap.bmp">
|
||||
<CopyFileToFolders Include="..\..\..\test\gamepadmap.bmp">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
|
||||
@ -353,7 +353,7 @@
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="..\..\..\test\controllermap_back.bmp">
|
||||
<CopyFileToFolders Include="..\..\..\test\gamepadmap_back.bmp">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">Copying %(Filename)%(Extension)</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">Copying %(Filename)%(Extension)</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">Copying %(Filename)%(Extension)</Message>
|
||||
@ -381,7 +381,7 @@
|
||||
</CopyFileToFolders>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\testgamecontroller.c" />
|
||||
<ClCompile Include="..\..\..\test\testgamepad.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\testgamecontroller.c" />
|
||||
<ClCompile Include="..\..\..\test\testgamepad.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="..\..\..\test\controllermap_back.bmp" />
|
||||
<CopyFileToFolders Include="..\..\..\test\gamepadmap_back.bmp" />
|
||||
<CopyFileToFolders Include="..\..\..\test\axis.bmp" />
|
||||
<CopyFileToFolders Include="..\..\..\test\button.bmp" />
|
||||
<CopyFileToFolders Include="..\..\..\test\controllermap.bmp" />
|
||||
<CopyFileToFolders Include="..\..\..\test\gamepadmap.bmp" />
|
||||
<CopyFileToFolders Include="..\..\logos\Logo44x44.png">
|
||||
<Filter>logos</Filter>
|
||||
</CopyFileToFolders>
|
@ -7,7 +7,7 @@
|
||||
Publisher="CN=Publisher"/>
|
||||
|
||||
<ExecutableList>
|
||||
<Executable Name="testgamecontroller.exe"
|
||||
<Executable Name="testgamepad.exe"
|
||||
TargetDeviceFamily="PC"
|
||||
Id="Game" />
|
||||
</ExecutableList>
|
||||
@ -22,12 +22,12 @@
|
||||
<MSAAppId>PleaseChangeMe</MSAAppId>
|
||||
<TitleId>FFFFFFFF</TitleId>
|
||||
|
||||
<ShellVisuals DefaultDisplayName="testgamecontroller"
|
||||
<ShellVisuals DefaultDisplayName="testgamepad"
|
||||
PublisherDisplayName="SDL"
|
||||
Square480x480Logo="Logo480x480.png"
|
||||
Square150x150Logo="Logo150x150.png"
|
||||
Square44x44Logo="Logo44x44.png"
|
||||
Description="testgamecontroller"
|
||||
Description="testgamepad"
|
||||
ForegroundText="light"
|
||||
BackgroundColor="#000000"
|
||||
StoreLogo="Logo100x100.png"/>
|
@ -7,7 +7,7 @@
|
||||
Publisher="CN=Publisher"/>
|
||||
|
||||
<ExecutableList>
|
||||
<Executable Name="testgamecontroller.exe"
|
||||
<Executable Name="testgamepad.exe"
|
||||
TargetDeviceFamily="XboxOne"
|
||||
Id="Game" />
|
||||
</ExecutableList>
|
||||
@ -16,13 +16,13 @@
|
||||
<MSAAppId>PleaseChangeMe</MSAAppId>
|
||||
<TitleId>FFFFFFFF</TitleId>
|
||||
|
||||
<ShellVisuals DefaultDisplayName="testgamecontroller"
|
||||
<ShellVisuals DefaultDisplayName="testgamepad"
|
||||
PublisherDisplayName="SDL"
|
||||
Square480x480Logo="Logo480x480.png"
|
||||
Square150x150Logo="Logo150x150.png"
|
||||
Square44x44Logo="Logo44x44.png"
|
||||
SplashScreenImage="SplashScreenImage.png"
|
||||
Description="testgamecontroller"
|
||||
Description="testgamepad"
|
||||
ForegroundText="light"
|
||||
BackgroundColor="#000000"
|
||||
StoreLogo="Logo100x100.png"/>
|
@ -7,7 +7,7 @@
|
||||
Publisher="CN=Publisher"/>
|
||||
|
||||
<ExecutableList>
|
||||
<Executable Name="testgamecontroller.exe"
|
||||
<Executable Name="testgamepad.exe"
|
||||
TargetDeviceFamily="Scarlett"
|
||||
Id="Game" />
|
||||
</ExecutableList>
|
||||
@ -16,13 +16,13 @@
|
||||
<MSAAppId>PleaseChangeMe</MSAAppId>
|
||||
<TitleId>FFFFFFFF</TitleId>
|
||||
|
||||
<ShellVisuals DefaultDisplayName="testgamecontroller"
|
||||
<ShellVisuals DefaultDisplayName="testgamepad"
|
||||
PublisherDisplayName="SDL"
|
||||
Square480x480Logo="Logo480x480.png"
|
||||
Square150x150Logo="Logo150x150.png"
|
||||
Square44x44Logo="Logo44x44.png"
|
||||
SplashScreenImage="SplashScreenImage.png"
|
||||
Description="testgamecontroller"
|
||||
Description="testgamepad"
|
||||
ForegroundText="light"
|
||||
BackgroundColor="#000000"
|
||||
StoreLogo="Logo100x100.png"/>
|
@ -121,7 +121,7 @@
|
||||
<ClInclude Include="..\src\haptic\windows\SDL_windowshaptic_c.h" />
|
||||
<ClInclude Include="..\src\haptic\windows\SDL_xinputhaptic_c.h" />
|
||||
<ClInclude Include="..\src\joystick\controller_type.h" />
|
||||
<ClInclude Include="..\src\joystick\SDL_gamecontrollerdb.h" />
|
||||
<ClInclude Include="..\src\joystick\SDL_gamepad_db.h" />
|
||||
<ClInclude Include="..\src\joystick\SDL_joystick_c.h" />
|
||||
<ClInclude Include="..\src\joystick\SDL_sysjoystick.h" />
|
||||
<ClInclude Include="..\src\joystick\virtual\SDL_virtualjoystick_c.h" />
|
||||
@ -317,7 +317,7 @@
|
||||
<ClCompile Include="..\src\hidapi\SDL_hidapi.c" />
|
||||
<ClCompile Include="..\src\joystick\dummy\SDL_sysjoystick.c" />
|
||||
<ClCompile Include="..\src\joystick\controller_type.c" />
|
||||
<ClCompile Include="..\src\joystick\SDL_gamecontroller.c" />
|
||||
<ClCompile Include="..\src\joystick\SDL_gamepad.c" />
|
||||
<ClCompile Include="..\src\joystick\SDL_joystick.c" />
|
||||
<ClCompile Include="..\src\joystick\virtual\SDL_virtualjoystick.c" />
|
||||
<ClCompile Include="..\src\joystick\windows\SDL_dinputjoystick.c" />
|
||||
|
@ -162,7 +162,7 @@
|
||||
<ClInclude Include="..\include\SDL3\SDL_video.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\joystick\SDL_gamecontrollerdb.h">
|
||||
<ClInclude Include="..\src\joystick\SDL_gamepad_db.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\audio\disk\SDL_diskaudio.h">
|
||||
@ -540,7 +540,7 @@
|
||||
<ClCompile Include="..\src\joystick\dummy\SDL_sysjoystick.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\joystick\SDL_gamecontroller.c">
|
||||
<ClCompile Include="..\src\joystick\SDL_gamepad.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\joystick\SDL_joystick.c">
|
||||
|
@ -38,11 +38,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsp
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3_test", "SDL_test\SDL_test.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamecontroller", "tests\testgamecontroller\testgamecontroller.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08305}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamepad", "tests\testgamepad\testgamepad.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08305}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgles2", "tests\testgles2\testgles2.vcxproj", "{E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "controllermap", "tests\controllermap\controllermap.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08306}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gamepadmap", "tests\gamepadmap\gamepadmap.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08306}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testvulkan", "tests\testvulkan\testvulkan.vcxproj", "{0D604DFD-AAB6-442C-9368-F91A344146AB}"
|
||||
EndProject
|
||||
|
@ -250,7 +250,7 @@
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_error.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_events.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_filesystem.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_gamecontroller.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_gamepad.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_guid.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_haptic.h" />
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_hints.h" />
|
||||
@ -347,7 +347,7 @@
|
||||
<ClInclude Include="..\..\src\joystick\controller_type.h" />
|
||||
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
|
||||
<ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h" />
|
||||
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h" />
|
||||
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
|
||||
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
|
||||
<ClInclude Include="..\..\src\joystick\usb_ids.h" />
|
||||
@ -520,7 +520,7 @@
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360w.c" />
|
||||
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
|
||||
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
|
||||
<ClCompile Include="..\..\src\joystick\SDL_gamepad.c" />
|
||||
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
|
||||
<ClCompile Include="..\..\src\joystick\virtual\SDL_virtualjoystick.c" />
|
||||
<ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c" />
|
||||
|
@ -219,7 +219,7 @@
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_filesystem.h">
|
||||
<Filter>API Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_gamecontroller.h">
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_gamepad.h">
|
||||
<Filter>API Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\SDL3\SDL_guid.h">
|
||||
@ -477,7 +477,7 @@
|
||||
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h">
|
||||
<Filter>haptic</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h">
|
||||
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h">
|
||||
<Filter>joystick</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h">
|
||||
@ -904,7 +904,7 @@
|
||||
<ClCompile Include="..\..\src\joystick\controller_type.c">
|
||||
<Filter>joystick</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c">
|
||||
<ClCompile Include="..\..\src\joystick\SDL_gamepad.c">
|
||||
<Filter>joystick</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\joystick\SDL_joystick.c">
|
||||
|
@ -20,7 +20,7 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{55812185-D13C-4022-9C81-32E0F4A08306}</ProjectGuid>
|
||||
<RootNamespace>controllermap</RootNamespace>
|
||||
<RootNamespace>gamepadmap</RootNamespace>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
@ -89,7 +89,7 @@
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/controllermap.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Release/gamepadmap.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -112,7 +112,7 @@
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/controllermap.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Release/gamepadmap.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -135,7 +135,7 @@
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/controllermap.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Debug/gamepadmap.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@ -161,7 +161,7 @@
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/controllermap.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Debug/gamepadmap.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@ -226,7 +226,7 @@
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\..\..\test\controllermap.bmp">
|
||||
<CustomBuild Include="..\..\..\test\gamepadmap.bmp">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
|
||||
</Command>
|
||||
@ -244,7 +244,7 @@
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\..\..\test\controllermap_back.bmp">
|
||||
<CustomBuild Include="..\..\..\test\gamepadmap_back.bmp">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
|
||||
</Command>
|
||||
@ -264,7 +264,7 @@
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\controllermap.c" />
|
||||
<ClCompile Include="..\..\..\test\gamepadmap.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
@ -20,7 +20,7 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{55812185-D13C-4022-9C81-32E0F4A08305}</ProjectGuid>
|
||||
<RootNamespace>testgamecontroller</RootNamespace>
|
||||
<RootNamespace>testgamepad</RootNamespace>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
@ -89,7 +89,7 @@
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Release/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -112,7 +112,7 @@
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Release/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -135,7 +135,7 @@
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Debug/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@ -161,7 +161,7 @@
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/testgamecontroller.tlb</TypeLibraryName>
|
||||
<TypeLibraryName>.\Debug/testgamepad.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@ -226,7 +226,7 @@
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\..\..\test\controllermap.bmp">
|
||||
<CustomBuild Include="..\..\..\test\gamepadmap.bmp">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
|
||||
</Command>
|
||||
@ -244,7 +244,7 @@
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\..\..\test\controllermap_back.bmp">
|
||||
<CustomBuild Include="..\..\..\test\gamepadmap_back.bmp">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
|
||||
</Command>
|
||||
@ -264,7 +264,7 @@
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\testgamecontroller.c" />
|
||||
<ClCompile Include="..\..\..\test\testgamepad.c" />
|
||||
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
209
WhatsNew.txt
209
WhatsNew.txt
@ -9,13 +9,44 @@ General:
|
||||
* SDL headers should now be included as `#include <SDL3/SDL.h>`
|
||||
* M_PI is no longer defined in SDL_stdinc.h, now the symbols SDL_PI_D (double) and SDL_PI_F (float) are available
|
||||
* SDL_GetWindowWMInfo() returns a standard int result code instead of SDL_bool, and takes SDL_SYSWM_CURRENT_VERSION as a new third parameter
|
||||
* The following functions have been removed, see docs/README-migration.md for details:
|
||||
* SDL_AudioInit()
|
||||
* SDL_AudioQuit()
|
||||
* SDL_CalculateGammaRamp()
|
||||
* SDL_CreateRGBSurface()
|
||||
* SDL_CreateRGBSurfaceFrom()
|
||||
* SDL_CreateRGBSurfaceWithFormat()
|
||||
* SDL_CreateRGBSurfaceWithFormatFrom()
|
||||
* SDL_GameControllerGetSensorDataWithTimestamp()
|
||||
* SDL_GetRevisionNumber()
|
||||
* SDL_GetWindowBrightness()
|
||||
* SDL_GetWindowGammaRamp()
|
||||
* SDL_RWFromFP()
|
||||
* SDL_SensorGetDataWithTimestamp()
|
||||
* SDL_SetWindowBrightness()
|
||||
* SDL_SetWindowGammaRamp()
|
||||
* SDL_VideoInit()
|
||||
* SDL_VideoQuit()
|
||||
* The following hints have been removed, see docs/README-migration.md for details:
|
||||
* SDL_HINT_IDLE_TIMER_DISABLED
|
||||
* SDL_HINT_VIDEO_X11_FORCE_EGL
|
||||
* SDL_HINT_VIDEO_X11_XINERAMA
|
||||
* SDL_HINT_VIDEO_X11_XVIDMODE
|
||||
* SDL_FreeWAV has been removed and calls can be replaced with SDL_free
|
||||
* Renamed hints 'SDL_HINT_VIDEODRIVER' and 'SDL_HINT_AUDIODRIVER' to 'SDL_HINT_VIDEO_DRIVER' and 'SDL_HINT_AUDIO_DRIVER'
|
||||
* Renamed environment variables 'SDL_VIDEODRIVER' and 'SDL_AUDIODRIVER' to 'SDL_VIDEO_DRIVER' and 'SDL_AUDIO_DRIVER'
|
||||
* SDL_stdinc.h no longer includes stdio.h, stdlib.h, etc., it only provides the SDL C runtime functionality
|
||||
* Added SDL_CreateSurface() and SDL_CreateSurfaceFrom() which replace the SDL_CreateRGBSurface*(), and can also be used to create YUV surfaces
|
||||
* Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat
|
||||
* Removed 'SDL_GL_CONTEXT_EGL' from OpenGL configuration attributes
|
||||
* SDL_GetTicks() now returns a 64-bit value and the tick values should be directly compared instead of using the SDL_TICKS_PASSED macro
|
||||
* Added SDL_GetTicksNS() to return the number of nanoseconds since the SDL library initialized
|
||||
* Added SDL_DelayNS() to specify a delay in nanoseconds, to the highest precision the system will support
|
||||
* The timestamp member of the SDL_Event structure is now in nanoseconds, filled in with the time the event was generated, or the time it was queued if that's not available
|
||||
* The `SDL_DISPLAYEVENT_*` and `SDL_WINDOWEVENT_*` events have been moved to top level events
|
||||
* Intrinsic headers are no longer included in the public SDL headers
|
||||
* The preprocessor symbol __MACOSX__ has been renamed __MACOS__
|
||||
* The preprocessor symbol __IPHONEOS__ has been renamed __IOS__
|
||||
* The following macros have been renamed:
|
||||
* RW_SEEK_CUR -> SDL_RW_SEEK_CUR
|
||||
* RW_SEEK_END -> SDL_RW_SEEK_END
|
||||
* RW_SEEK_SET -> SDL_RW_SEEK_SET
|
||||
* SDL_FreeWAV has been removed and calls can be replaced with SDL_free
|
||||
* The following functions have been renamed:
|
||||
* SDL_AllocFormat => SDL_CreatePixelFormat
|
||||
* SDL_AllocPalette => SDL_CreatePalette
|
||||
@ -30,12 +61,69 @@ General:
|
||||
* SDL_FreeFormat => SDL_DestroyPixelFormat
|
||||
* SDL_FreePalette => SDL_DestroyPalette
|
||||
* SDL_FreeSurface => SDL_DestroySurface
|
||||
* SDL_GameControllerAddMapping => SDL_AddGamepadMapping
|
||||
* SDL_GameControllerAddMappingsFromFile => SDL_AddGamepadMappingsFromFile
|
||||
* SDL_GameControllerAddMappingsFromRW => SDL_AddGamepadMappingsFromRW
|
||||
* SDL_GameControllerClose => SDL_CloseGamepad
|
||||
* SDL_GameControllerEventState => SDL_GetGamepadEventState
|
||||
* SDL_GameControllerFromInstanceID => SDL_GetGamepadFromInstanceID
|
||||
* SDL_GameControllerFromPlayerIndex => SDL_GetGamepadFromPlayerIndex
|
||||
* SDL_GameControllerGetAppleSFSymbolsNameForAxis => SDL_GetGamepadAppleSFSymbolsNameForAxis
|
||||
* SDL_GameControllerGetAppleSFSymbolsNameForButton => SDL_GetGamepadAppleSFSymbolsNameForButton
|
||||
* SDL_GameControllerGetAttached => SDL_IsGamepadConnected
|
||||
* SDL_GameControllerGetAxis => SDL_GetGamepadAxis
|
||||
* SDL_GameControllerGetAxisFromString => SDL_GetGamepadAxisFromString
|
||||
* SDL_GameControllerGetBindForAxis => SDL_GetGamepadBindForAxis
|
||||
* SDL_GameControllerGetBindForButton => SDL_GetGamepadBindForButton
|
||||
* SDL_GameControllerGetButton => SDL_GetGamepadButton
|
||||
* SDL_GameControllerGetButtonFromString => SDL_GetGamepadButtonFromString
|
||||
* SDL_GameControllerGetFirmwareVersion => SDL_GetGamepadFirmwareVersion
|
||||
* SDL_GameControllerGetJoystick => SDL_GetGamepadJoystick
|
||||
* SDL_GameControllerGetNumTouchpadFingers => SDL_GetGamepadNumTouchpadFingers
|
||||
* SDL_GameControllerGetNumTouchpads => SDL_GetGamepadNumTouchpads
|
||||
* SDL_GameControllerGetPlayerIndex => SDL_GetGamepadPlayerIndex
|
||||
* SDL_GameControllerGetProduct => SDL_GetGamepadProduct
|
||||
* SDL_GameControllerGetProductVersion => SDL_GetGamepadProductVersion
|
||||
* SDL_GameControllerGetSensorData => SDL_GetGamepadSensorData
|
||||
* SDL_GameControllerGetSensorDataRate => SDL_GetGamepadSensorDataRate
|
||||
* SDL_GameControllerGetSerial => SDL_GetGamepadSerial
|
||||
* SDL_GameControllerGetStringForAxis => SDL_GetGamepadStringForAxis
|
||||
* SDL_GameControllerGetStringForButton => SDL_GetGamepadStringForButton
|
||||
* SDL_GameControllerGetTouchpadFinger => SDL_GetGamepadTouchpadFinger
|
||||
* SDL_GameControllerGetType => SDL_GetGamepadType
|
||||
* SDL_GameControllerGetVendor => SDL_GetGamepadVendor
|
||||
* SDL_GameControllerHasAxis => SDL_GamepadHasAxis
|
||||
* SDL_GameControllerHasButton => SDL_GamepadHasButton
|
||||
* SDL_GameControllerHasLED => SDL_GamepadHasLED
|
||||
* SDL_GameControllerHasRumble => SDL_GamepadHasRumble
|
||||
* SDL_GameControllerHasRumbleTriggers => SDL_GamepadHasRumbleTriggers
|
||||
* SDL_GameControllerHasSensor => SDL_GamepadHasSensor
|
||||
* SDL_GameControllerIsSensorEnabled => SDL_IsGamepadSensorEnabled
|
||||
* SDL_GameControllerMapping => SDL_GetGamepadMapping
|
||||
* SDL_GameControllerMappingForDeviceIndex => SDL_GetGamepadMappingForDeviceIndex
|
||||
* SDL_GameControllerMappingForGUID => SDL_GetGamepadMappingForGUID
|
||||
* SDL_GameControllerMappingForIndex => SDL_GetGamepadMappingForIndex
|
||||
* SDL_GameControllerName => SDL_GetGamepadName
|
||||
* SDL_GameControllerNameForIndex => SDL_GetGamepadNameForIndex
|
||||
* SDL_GameControllerNumMappings => SDL_GetNumGamepadMappings
|
||||
* SDL_GameControllerOpen => SDL_OpenGamepad
|
||||
* SDL_GameControllerPath => SDL_GetGamepadPath
|
||||
* SDL_GameControllerPathForIndex => SDL_GetGamepadPathForIndex
|
||||
* SDL_GameControllerRumble => SDL_RumbleGamepad
|
||||
* SDL_GameControllerRumbleTriggers => SDL_RumbleGamepadTriggers
|
||||
* SDL_GameControllerSendEffect => SDL_SendGamepadEffect
|
||||
* SDL_GameControllerSetLED => SDL_SetGamepadLED
|
||||
* SDL_GameControllerSetPlayerIndex => SDL_SetGamepadPlayerIndex
|
||||
* SDL_GameControllerSetSensorEnabled => SDL_SetGamepadSensorEnabled
|
||||
* SDL_GameControllerTypeForIndex => SDL_GetGamepadTypeForIndex
|
||||
* SDL_GameControllerUpdate => SDL_UpdateGamepads
|
||||
* SDL_GetClipRect => SDL_GetSurfaceClipRect
|
||||
* SDL_GetColorKey => SDL_GetSurfaceColorKey
|
||||
* SDL_GetPointDisplayIndex => SDL_GetDisplayIndexForPoint
|
||||
* SDL_GetRectDisplayIndex => SDL_GetDisplayIndexForRect
|
||||
* SDL_HasColorKey => SDL_SurfaceHasColorKey
|
||||
* SDL_HasSurfaceRLE => SDL_SurfaceHasRLE
|
||||
* SDL_IsGameController => SDL_IsGamepad
|
||||
* SDL_JoystickAttachVirtual => SDL_AttachVirtualJoystick
|
||||
* SDL_JoystickAttachVirtualEx => SDL_AttachVirtualJoystickEx
|
||||
* SDL_JoystickClose => SDL_CloseJoystick
|
||||
@ -141,42 +229,20 @@ General:
|
||||
* SDL_SetColorKey => SDL_SetSurfaceColorKey
|
||||
* SDL_UpperBlit => SDL_BlitSurface
|
||||
* SDL_UpperBlitScaled => SDL_BlitSurfaceScaled
|
||||
* Removed the following functions from the API, see docs/README-migration.md for details:
|
||||
* SDL_AudioInit()
|
||||
* SDL_AudioQuit()
|
||||
* SDL_CalculateGammaRamp()
|
||||
* SDL_CreateRGBSurface()
|
||||
* SDL_CreateRGBSurfaceFrom()
|
||||
* SDL_CreateRGBSurfaceWithFormat()
|
||||
* SDL_CreateRGBSurfaceWithFormatFrom()
|
||||
* SDL_GameControllerGetSensorDataWithTimestamp()
|
||||
* SDL_GetRevisionNumber()
|
||||
* SDL_GetWindowBrightness()
|
||||
* SDL_GetWindowGammaRamp()
|
||||
* SDL_RWFromFP()
|
||||
* SDL_SensorGetDataWithTimestamp()
|
||||
* SDL_SetWindowBrightness()
|
||||
* SDL_SetWindowGammaRamp()
|
||||
* SDL_VideoInit()
|
||||
* SDL_VideoQuit()
|
||||
* Removed the following hints from the API, see docs/README-migration.md for details:
|
||||
* SDL_HINT_IDLE_TIMER_DISABLED
|
||||
* SDL_HINT_VIDEO_X11_FORCE_EGL
|
||||
* SDL_HINT_VIDEO_X11_XINERAMA
|
||||
* SDL_HINT_VIDEO_X11_XVIDMODE
|
||||
* Renamed hints 'SDL_HINT_VIDEODRIVER' and 'SDL_HINT_AUDIODRIVER' to 'SDL_HINT_VIDEO_DRIVER' and 'SDL_HINT_AUDIO_DRIVER'
|
||||
* Renamed environment variables 'SDL_VIDEODRIVER' and 'SDL_AUDIODRIVER' to 'SDL_VIDEO_DRIVER' and 'SDL_AUDIO_DRIVER'
|
||||
* SDL_stdinc.h no longer includes stdio.h, stdlib.h, etc., it only provides the SDL C runtime functionality
|
||||
* Added SDL_CreateSurface() and SDL_CreateSurfaceFrom() which replace the SDL_CreateRGBSurface*(), and can also be used to create YUV surfaces
|
||||
* Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat
|
||||
* Removed 'SDL_GL_CONTEXT_EGL' from OpenGL configuration attributes
|
||||
* SDL_GetTicks() now returns a 64-bit value and the tick values should be directly compared instead of using the SDL_TICKS_PASSED macro
|
||||
* Added SDL_GetTicksNS() to return the number of nanoseconds since the SDL library initialized
|
||||
* Added SDL_DelayNS() to specify a delay in nanoseconds, to the highest precision the system will support
|
||||
* The timestamp member of the SDL_Event structure is now in nanoseconds, filled in with the time the event was generated, or the time it was queued if that's not available
|
||||
* The `SDL_DISPLAYEVENT_*` and `SDL_WINDOWEVENT_*` events have been moved to top level events
|
||||
* Intrinsic headers are no longer included in the public SDL headers
|
||||
* The following enums have been renamed:
|
||||
* SDL_GameControllerAxis => SDL_GamepadAxis
|
||||
* SDL_GameControllerBindType => SDL_GamepadBindingType
|
||||
* SDL_GameControllerButton => SDL_GamepadButton
|
||||
* SDL_GameControllerType => SDL_GamepadType
|
||||
* The following structures have been renamed:
|
||||
* SDL_ControllerAxisEvent => SDL_GamepadAxisEvent
|
||||
* SDL_ControllerButtonEvent => SDL_GamepadButtonEvent
|
||||
* SDL_ControllerDeviceEvent => SDL_GamepadDeviceEvent
|
||||
* SDL_ControllerSensorEvent => SDL_GamepadSensorEvent
|
||||
* SDL_ControllerTouchpadEvent => SDL_GamepadTouchpadEvent
|
||||
* SDL_GameController => SDL_Gamepad
|
||||
* SDL_GameControllerButtonBind => SDL_GamepadBinding
|
||||
* The following symbols have been renamed:
|
||||
* KMOD_ALT => SDL_KMOD_ALT
|
||||
* KMOD_CAPS => SDL_KMOD_CAPS
|
||||
* KMOD_CTRL => SDL_KMOD_CTRL
|
||||
@ -195,3 +261,66 @@ General:
|
||||
* KMOD_RSHIFT => SDL_KMOD_RSHIFT
|
||||
* KMOD_SCROLL => SDL_KMOD_SCROLL
|
||||
* KMOD_SHIFT => SDL_KMOD_SHIFT
|
||||
* RW_SEEK_CUR => SDL_RW_SEEK_CUR
|
||||
* RW_SEEK_END => SDL_RW_SEEK_END
|
||||
* RW_SEEK_SET => SDL_RW_SEEK_SET
|
||||
* SDL_CONTROLLERAXISMOTION => SDL_GAMEPADAXISMOTION
|
||||
* SDL_CONTROLLERBUTTONDOWN => SDL_GAMEPADBUTTONDOWN
|
||||
* SDL_CONTROLLERBUTTONUP => SDL_GAMEPADBUTTONUP
|
||||
* SDL_CONTROLLERDEVICEADDED => SDL_GAMEPADADDED
|
||||
* SDL_CONTROLLERDEVICEREMAPPED => SDL_GAMEPADDEVICEREMAPPED
|
||||
* SDL_CONTROLLERDEVICEREMOVED => SDL_GAMEPADREMOVED
|
||||
* SDL_CONTROLLERSENSORUPDATE => SDL_GAMEPADSENSORUPDATE
|
||||
* SDL_CONTROLLERTOUCHPADDOWN => SDL_GAMEPADTOUCHPADDOWN
|
||||
* SDL_CONTROLLERTOUCHPADMOTION => SDL_GAMEPADTOUCHPADMOTION
|
||||
* SDL_CONTROLLERTOUCHPADUP => SDL_GAMEPADTOUCHPADUP
|
||||
* SDL_CONTROLLER_AXIS_INVALID => SDL_GAMEPAD_AXIS_INVALID
|
||||
* SDL_CONTROLLER_AXIS_LEFTX => SDL_GAMEPAD_AXIS_LEFTX
|
||||
* SDL_CONTROLLER_AXIS_LEFTY => SDL_GAMEPAD_AXIS_LEFTY
|
||||
* SDL_CONTROLLER_AXIS_MAX => SDL_GAMEPAD_AXIS_MAX
|
||||
* SDL_CONTROLLER_AXIS_RIGHTX => SDL_GAMEPAD_AXIS_RIGHTX
|
||||
* SDL_CONTROLLER_AXIS_RIGHTY => SDL_GAMEPAD_AXIS_RIGHTY
|
||||
* SDL_CONTROLLER_AXIS_TRIGGERLEFT => SDL_GAMEPAD_AXIS_LEFT_TRIGGER
|
||||
* SDL_CONTROLLER_AXIS_TRIGGERRIGHT => SDL_GAMEPAD_AXIS_RIGHT_TRIGGER
|
||||
* SDL_CONTROLLER_BINDTYPE_AXIS => SDL_GAMEPAD_BINDTYPE_AXIS
|
||||
* SDL_CONTROLLER_BINDTYPE_BUTTON => SDL_GAMEPAD_BINDTYPE_BUTTON
|
||||
* SDL_CONTROLLER_BINDTYPE_HAT => SDL_GAMEPAD_BINDTYPE_HAT
|
||||
* SDL_CONTROLLER_BINDTYPE_NONE => SDL_GAMEPAD_BINDTYPE_NONE
|
||||
* SDL_CONTROLLER_BUTTON_A => SDL_GAMEPAD_BUTTON_A
|
||||
* SDL_CONTROLLER_BUTTON_B => SDL_GAMEPAD_BUTTON_B
|
||||
* SDL_CONTROLLER_BUTTON_BACK => SDL_GAMEPAD_BUTTON_BACK
|
||||
* SDL_CONTROLLER_BUTTON_DPAD_DOWN => SDL_GAMEPAD_BUTTON_DPAD_DOWN
|
||||
* SDL_CONTROLLER_BUTTON_DPAD_LEFT => SDL_GAMEPAD_BUTTON_DPAD_LEFT
|
||||
* SDL_CONTROLLER_BUTTON_DPAD_RIGHT => SDL_GAMEPAD_BUTTON_DPAD_RIGHT
|
||||
* SDL_CONTROLLER_BUTTON_DPAD_UP => SDL_GAMEPAD_BUTTON_DPAD_UP
|
||||
* SDL_CONTROLLER_BUTTON_GUIDE => SDL_GAMEPAD_BUTTON_GUIDE
|
||||
* SDL_CONTROLLER_BUTTON_INVALID => SDL_GAMEPAD_BUTTON_INVALID
|
||||
* SDL_CONTROLLER_BUTTON_LEFTSHOULDER => SDL_GAMEPAD_BUTTON_LEFT_SHOULDER
|
||||
* SDL_CONTROLLER_BUTTON_LEFTSTICK => SDL_GAMEPAD_BUTTON_LEFT_STICK
|
||||
* SDL_CONTROLLER_BUTTON_MAX => SDL_GAMEPAD_BUTTON_MAX
|
||||
* SDL_INIT_GAMECONTROLLER => SDL_INIT_GAMEPAD
|
||||
* SDL_CONTROLLER_BUTTON_MISC1 => SDL_GAMEPAD_BUTTON_MISC1
|
||||
* SDL_CONTROLLER_BUTTON_PADDLE1 => SDL_GAMEPAD_BUTTON_PADDLE1
|
||||
* SDL_CONTROLLER_BUTTON_PADDLE2 => SDL_GAMEPAD_BUTTON_PADDLE2
|
||||
* SDL_CONTROLLER_BUTTON_PADDLE3 => SDL_GAMEPAD_BUTTON_PADDLE3
|
||||
* SDL_CONTROLLER_BUTTON_PADDLE4 => SDL_GAMEPAD_BUTTON_PADDLE4
|
||||
* SDL_CONTROLLER_BUTTON_RIGHTSHOULDER => SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER
|
||||
* SDL_CONTROLLER_BUTTON_RIGHTSTICK => SDL_GAMEPAD_BUTTON_RIGHT_STICK
|
||||
* SDL_CONTROLLER_BUTTON_START => SDL_GAMEPAD_BUTTON_START
|
||||
* SDL_CONTROLLER_BUTTON_TOUCHPAD => SDL_GAMEPAD_BUTTON_TOUCHPAD
|
||||
* SDL_CONTROLLER_BUTTON_X => SDL_GAMEPAD_BUTTON_X
|
||||
* SDL_CONTROLLER_BUTTON_Y => SDL_GAMEPAD_BUTTON_Y
|
||||
* SDL_CONTROLLER_TYPE_AMAZON_LUNA => SDL_GAMEPAD_TYPE_AMAZON_LUNA
|
||||
* SDL_CONTROLLER_TYPE_GOOGLE_STADIA => SDL_GAMEPAD_TYPE_GOOGLE_STADIA
|
||||
* SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT => SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT
|
||||
* SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR => SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
|
||||
* SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT => SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT
|
||||
* SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO => SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO
|
||||
* SDL_CONTROLLER_TYPE_NVIDIA_SHIELD => SDL_GAMEPAD_TYPE_NVIDIA_SHIELD
|
||||
* SDL_CONTROLLER_TYPE_PS3 => SDL_GAMEPAD_TYPE_PS3
|
||||
* SDL_CONTROLLER_TYPE_PS4 => SDL_GAMEPAD_TYPE_PS4
|
||||
* SDL_CONTROLLER_TYPE_PS5 => SDL_GAMEPAD_TYPE_PS5
|
||||
* SDL_CONTROLLER_TYPE_UNKNOWN => SDL_GAMEPAD_TYPE_UNKNOWN
|
||||
* SDL_CONTROLLER_TYPE_VIRTUAL => SDL_GAMEPAD_TYPE_VIRTUAL
|
||||
* SDL_CONTROLLER_TYPE_XBOX360 => SDL_GAMEPAD_TYPE_XBOX360
|
||||
* SDL_CONTROLLER_TYPE_XBOXONE => SDL_GAMEPAD_TYPE_XBOXONE
|
||||
|
@ -222,7 +222,7 @@
|
||||
A75FCD8723E25AB700529352 /* SDL_steamcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7A523E2513E00DCD162 /* SDL_steamcontroller.h */; };
|
||||
A75FCD8823E25AB700529352 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93623E2514000DCD162 /* scancodes_linux.h */; };
|
||||
A75FCD8A23E25AB700529352 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93723E2514000DCD162 /* SDL_touch_c.h */; };
|
||||
A75FCD8B23E25AB700529352 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */; };
|
||||
A75FCD8B23E25AB700529352 /* SDL_gamepad_db.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */; };
|
||||
A75FCD8C23E25AB700529352 /* SDL_cocoavulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A68F23E2513E00DCD162 /* SDL_cocoavulkan.h */; };
|
||||
A75FCD8D23E25AB700529352 /* gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72523E2513E00DCD162 /* gl2platform.h */; };
|
||||
A75FCD8F23E25AB700529352 /* vk_layer.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72D23E2513E00DCD162 /* vk_layer.h */; };
|
||||
@ -312,7 +312,7 @@
|
||||
A75FCE0923E25AB700529352 /* s_scalbn.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A91A23E2514000DCD162 /* s_scalbn.c */; };
|
||||
A75FCE0A23E25AB700529352 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5DF23E2513D00DCD162 /* SDL_timer.c */; };
|
||||
A75FCE0B23E25AB700529352 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A8F023E2514000DCD162 /* SDL_blendpoint.c */; };
|
||||
A75FCE0C23E25AB700529352 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */; };
|
||||
A75FCE0C23E25AB700529352 /* SDL_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */; };
|
||||
A75FCE0D23E25AB700529352 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5E223E2513D00DCD162 /* SDL_systimer.c */; };
|
||||
A75FCE0E23E25AB700529352 /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A62A23E2513D00DCD162 /* SDL_uikitclipboard.m */; };
|
||||
A75FCE0F23E25AB700529352 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A8F923E2514000DCD162 /* SDL_render_sw.c */; };
|
||||
@ -535,7 +535,7 @@
|
||||
A75FCF4023E25AC700529352 /* SDL_steamcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7A523E2513E00DCD162 /* SDL_steamcontroller.h */; };
|
||||
A75FCF4123E25AC700529352 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93623E2514000DCD162 /* scancodes_linux.h */; };
|
||||
A75FCF4323E25AC700529352 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93723E2514000DCD162 /* SDL_touch_c.h */; };
|
||||
A75FCF4423E25AC700529352 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */; };
|
||||
A75FCF4423E25AC700529352 /* SDL_gamepad_db.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */; };
|
||||
A75FCF4523E25AC700529352 /* SDL_cocoavulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A68F23E2513E00DCD162 /* SDL_cocoavulkan.h */; };
|
||||
A75FCF4623E25AC700529352 /* gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72523E2513E00DCD162 /* gl2platform.h */; };
|
||||
A75FCF4823E25AC700529352 /* vk_layer.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72D23E2513E00DCD162 /* vk_layer.h */; };
|
||||
@ -625,7 +625,7 @@
|
||||
A75FCFC223E25AC700529352 /* s_scalbn.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A91A23E2514000DCD162 /* s_scalbn.c */; };
|
||||
A75FCFC323E25AC700529352 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5DF23E2513D00DCD162 /* SDL_timer.c */; };
|
||||
A75FCFC423E25AC700529352 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A8F023E2514000DCD162 /* SDL_blendpoint.c */; };
|
||||
A75FCFC523E25AC700529352 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */; };
|
||||
A75FCFC523E25AC700529352 /* SDL_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */; };
|
||||
A75FCFC623E25AC700529352 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5E223E2513D00DCD162 /* SDL_systimer.c */; };
|
||||
A75FCFC723E25AC700529352 /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A62A23E2513D00DCD162 /* SDL_uikitclipboard.m */; };
|
||||
A75FCFC823E25AC700529352 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A8F923E2514000DCD162 /* SDL_render_sw.c */; };
|
||||
@ -885,7 +885,7 @@
|
||||
A769B10D23E259AE00872273 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7CF23E2513E00DCD162 /* SDL_sysjoystick.h */; };
|
||||
A769B10E23E259AE00872273 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93623E2514000DCD162 /* scancodes_linux.h */; };
|
||||
A769B11023E259AE00872273 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93723E2514000DCD162 /* SDL_touch_c.h */; };
|
||||
A769B11123E259AE00872273 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */; };
|
||||
A769B11123E259AE00872273 /* SDL_gamepad_db.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */; };
|
||||
A769B11223E259AE00872273 /* SDL_cocoavulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A68F23E2513E00DCD162 /* SDL_cocoavulkan.h */; };
|
||||
A769B11323E259AE00872273 /* gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72523E2513E00DCD162 /* gl2platform.h */; };
|
||||
A769B11523E259AE00872273 /* vk_layer.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72D23E2513E00DCD162 /* vk_layer.h */; };
|
||||
@ -975,7 +975,7 @@
|
||||
A769B19223E259AE00872273 /* s_scalbn.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A91A23E2514000DCD162 /* s_scalbn.c */; };
|
||||
A769B19323E259AE00872273 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5DF23E2513D00DCD162 /* SDL_timer.c */; };
|
||||
A769B19423E259AE00872273 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A8F023E2514000DCD162 /* SDL_blendpoint.c */; };
|
||||
A769B19523E259AE00872273 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */; };
|
||||
A769B19523E259AE00872273 /* SDL_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */; };
|
||||
A769B19623E259AE00872273 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5E223E2513D00DCD162 /* SDL_systimer.c */; };
|
||||
A769B19723E259AE00872273 /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A62A23E2513D00DCD162 /* SDL_uikitclipboard.m */; };
|
||||
A769B19823E259AE00872273 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A8F923E2514000DCD162 /* SDL_render_sw.c */; };
|
||||
@ -2076,12 +2076,12 @@
|
||||
A7D8B44323E2514300DCD162 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A78823E2513E00DCD162 /* SDL_sysmutex_c.h */; };
|
||||
A7D8B44423E2514300DCD162 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A78823E2513E00DCD162 /* SDL_sysmutex_c.h */; };
|
||||
A7D8B44523E2514300DCD162 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A78823E2513E00DCD162 /* SDL_sysmutex_c.h */; };
|
||||
A7D8B4AC23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */; };
|
||||
A7D8B4AD23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */; };
|
||||
A7D8B4AE23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */; };
|
||||
A7D8B4AF23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */; };
|
||||
A7D8B4B023E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */; };
|
||||
A7D8B4B123E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */; };
|
||||
A7D8B4AC23E2514300DCD162 /* SDL_gamepad_db.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */; };
|
||||
A7D8B4AD23E2514300DCD162 /* SDL_gamepad_db.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */; };
|
||||
A7D8B4AE23E2514300DCD162 /* SDL_gamepad_db.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */; };
|
||||
A7D8B4AF23E2514300DCD162 /* SDL_gamepad_db.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */; };
|
||||
A7D8B4B023E2514300DCD162 /* SDL_gamepad_db.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */; };
|
||||
A7D8B4B123E2514300DCD162 /* SDL_gamepad_db.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */; };
|
||||
A7D8B4B223E2514300DCD162 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7A023E2513E00DCD162 /* SDL_sysjoystick.c */; };
|
||||
A7D8B4B323E2514300DCD162 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7A023E2513E00DCD162 /* SDL_sysjoystick.c */; };
|
||||
A7D8B4B423E2514300DCD162 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7A023E2513E00DCD162 /* SDL_sysjoystick.c */; };
|
||||
@ -2100,12 +2100,12 @@
|
||||
A7D8B4DF23E2514300DCD162 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7A923E2513E00DCD162 /* SDL_joystick.c */; };
|
||||
A7D8B4E023E2514300DCD162 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7A923E2513E00DCD162 /* SDL_joystick.c */; };
|
||||
A7D8B4E123E2514300DCD162 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7A923E2513E00DCD162 /* SDL_joystick.c */; };
|
||||
A7D8B4EE23E2514300DCD162 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */; };
|
||||
A7D8B4EF23E2514300DCD162 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */; };
|
||||
A7D8B4F023E2514300DCD162 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */; };
|
||||
A7D8B4F123E2514300DCD162 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */; };
|
||||
A7D8B4F223E2514300DCD162 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */; };
|
||||
A7D8B4F323E2514300DCD162 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */; };
|
||||
A7D8B4EE23E2514300DCD162 /* SDL_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */; };
|
||||
A7D8B4EF23E2514300DCD162 /* SDL_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */; };
|
||||
A7D8B4F023E2514300DCD162 /* SDL_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */; };
|
||||
A7D8B4F123E2514300DCD162 /* SDL_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */; };
|
||||
A7D8B4F223E2514300DCD162 /* SDL_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */; };
|
||||
A7D8B4F323E2514300DCD162 /* SDL_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */; };
|
||||
A7D8B53923E2514300DCD162 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7C223E2513E00DCD162 /* SDL_hidapi_xbox360.c */; };
|
||||
A7D8B53A23E2514300DCD162 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7C223E2513E00DCD162 /* SDL_hidapi_xbox360.c */; };
|
||||
A7D8B53B23E2514300DCD162 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A7C223E2513E00DCD162 /* SDL_hidapi_xbox360.c */; };
|
||||
@ -3360,10 +3360,10 @@
|
||||
F3F7D9822933074E00816151 /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8CF2933074C00816151 /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9832933074E00816151 /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8CF2933074C00816151 /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9842933074E00816151 /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8CF2933074C00816151 /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9852933074E00816151 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D02933074C00816151 /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9862933074E00816151 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D02933074C00816151 /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9872933074E00816151 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D02933074C00816151 /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9882933074E00816151 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D02933074C00816151 /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9852933074E00816151 /* SDL_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D02933074C00816151 /* SDL_gamepad.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9862933074E00816151 /* SDL_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D02933074C00816151 /* SDL_gamepad.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9872933074E00816151 /* SDL_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D02933074C00816151 /* SDL_gamepad.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9882933074E00816151 /* SDL_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D02933074C00816151 /* SDL_gamepad.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D9892933074E00816151 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D12933074C00816151 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D98A2933074E00816151 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D12933074C00816151 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F3F7D98B2933074E00816151 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8D12933074C00816151 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@ -3722,12 +3722,12 @@
|
||||
A7D8A78623E2513E00DCD162 /* SDL_systhread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systhread.c; sourceTree = "<group>"; };
|
||||
A7D8A78723E2513E00DCD162 /* SDL_sysmutex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysmutex.c; sourceTree = "<group>"; };
|
||||
A7D8A78823E2513E00DCD162 /* SDL_sysmutex_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysmutex_c.h; sourceTree = "<group>"; };
|
||||
A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontrollerdb.h; sourceTree = "<group>"; };
|
||||
A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamepad_db.h; sourceTree = "<group>"; };
|
||||
A7D8A7A023E2513E00DCD162 /* SDL_sysjoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysjoystick.c; sourceTree = "<group>"; };
|
||||
A7D8A7A523E2513E00DCD162 /* SDL_steamcontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_steamcontroller.h; sourceTree = "<group>"; };
|
||||
A7D8A7A723E2513E00DCD162 /* SDL_steamcontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_steamcontroller.c; sourceTree = "<group>"; };
|
||||
A7D8A7A923E2513E00DCD162 /* SDL_joystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_joystick.c; sourceTree = "<group>"; };
|
||||
A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gamecontroller.c; sourceTree = "<group>"; };
|
||||
A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gamepad.c; sourceTree = "<group>"; };
|
||||
A7D8A7C223E2513E00DCD162 /* SDL_hidapi_xbox360.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_xbox360.c; sourceTree = "<group>"; };
|
||||
A7D8A7C323E2513E00DCD162 /* SDL_hidapi_ps4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_ps4.c; sourceTree = "<group>"; };
|
||||
A7D8A7C423E2513E00DCD162 /* SDL_hidapijoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapijoystick.c; sourceTree = "<group>"; };
|
||||
@ -3945,7 +3945,7 @@
|
||||
F3F7D8CD2933074C00816151 /* SDL_thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_thread.h; path = SDL3/SDL_thread.h; sourceTree = "<group>"; };
|
||||
F3F7D8CE2933074C00816151 /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendmode.h; path = SDL3/SDL_blendmode.h; sourceTree = "<group>"; };
|
||||
F3F7D8CF2933074C00816151 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = SDL3/SDL.h; sourceTree = "<group>"; };
|
||||
F3F7D8D02933074C00816151 /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gamecontroller.h; path = SDL3/SDL_gamecontroller.h; sourceTree = "<group>"; };
|
||||
F3F7D8D02933074C00816151 /* SDL_gamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gamepad.h; path = SDL3/SDL_gamepad.h; sourceTree = "<group>"; };
|
||||
F3F7D8D12933074C00816151 /* SDL_guid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_guid.h; path = SDL3/SDL_guid.h; sourceTree = "<group>"; };
|
||||
F3F7D8D22933074C00816151 /* SDL_metal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_metal.h; path = SDL3/SDL_metal.h; sourceTree = "<group>"; };
|
||||
F3F7D8D32933074C00816151 /* SDL_joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_joystick.h; path = SDL3/SDL_joystick.h; sourceTree = "<group>"; };
|
||||
@ -4148,7 +4148,7 @@
|
||||
F3F7D8BC2933074A00816151 /* SDL_error.h */,
|
||||
F3F7D8CB2933074B00816151 /* SDL_events.h */,
|
||||
F3F7D8D62933074C00816151 /* SDL_filesystem.h */,
|
||||
F3F7D8D02933074C00816151 /* SDL_gamecontroller.h */,
|
||||
F3F7D8D02933074C00816151 /* SDL_gamepad.h */,
|
||||
F3F7D8D12933074C00816151 /* SDL_guid.h */,
|
||||
F3F7D8AD2933074900816151 /* SDL_haptic.h */,
|
||||
F3F7D8CA2933074B00816151 /* SDL_hidapi.h */,
|
||||
@ -4752,11 +4752,11 @@
|
||||
A7D8A7BE23E2513E00DCD162 /* hidapi */,
|
||||
A7D8A7A123E2513E00DCD162 /* steam */,
|
||||
75E09157241EA924004729E1 /* virtual */,
|
||||
A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */,
|
||||
A7D8A7AD23E2513E00DCD162 /* SDL_gamepad.c */,
|
||||
A7D8A7A923E2513E00DCD162 /* SDL_joystick.c */,
|
||||
F3820712284F3609004DD584 /* controller_type.c */,
|
||||
A7D8A7D923E2513E00DCD162 /* controller_type.h */,
|
||||
A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */,
|
||||
A7D8A79E23E2513E00DCD162 /* SDL_gamepad_db.h */,
|
||||
A7D8A7D023E2513E00DCD162 /* SDL_joystick_c.h */,
|
||||
A7D8A7CF23E2513E00DCD162 /* SDL_sysjoystick.h */,
|
||||
A7D8A7CB23E2513E00DCD162 /* usb_ids.h */,
|
||||
@ -5227,7 +5227,7 @@
|
||||
A75FCD1F23E25AB700529352 /* SDL_egl_c.h in Headers */,
|
||||
A75FCD1923E25AB700529352 /* SDL_error_c.h in Headers */,
|
||||
A75FCD7923E25AB700529352 /* SDL_events_c.h in Headers */,
|
||||
A75FCD8B23E25AB700529352 /* SDL_gamecontrollerdb.h in Headers */,
|
||||
A75FCD8B23E25AB700529352 /* SDL_gamepad_db.h in Headers */,
|
||||
A75FCDDB23E25AB700529352 /* SDL_gles2funcs.h in Headers */,
|
||||
A75FCD0723E25AB700529352 /* SDL_glfuncs.h in Headers */,
|
||||
A75FCD1623E25AB700529352 /* SDL_haptic_c.h in Headers */,
|
||||
@ -5392,7 +5392,7 @@
|
||||
A75FCED823E25AC700529352 /* SDL_egl_c.h in Headers */,
|
||||
A75FCED223E25AC700529352 /* SDL_error_c.h in Headers */,
|
||||
A75FCF3223E25AC700529352 /* SDL_events_c.h in Headers */,
|
||||
A75FCF4423E25AC700529352 /* SDL_gamecontrollerdb.h in Headers */,
|
||||
A75FCF4423E25AC700529352 /* SDL_gamepad_db.h in Headers */,
|
||||
A75FCF9423E25AC700529352 /* SDL_gles2funcs.h in Headers */,
|
||||
A75FCEC023E25AC700529352 /* SDL_glfuncs.h in Headers */,
|
||||
A75FCECF23E25AC700529352 /* SDL_haptic_c.h in Headers */,
|
||||
@ -5557,7 +5557,7 @@
|
||||
A769B0A623E259AE00872273 /* SDL_egl_c.h in Headers */,
|
||||
A769B0A023E259AE00872273 /* SDL_error_c.h in Headers */,
|
||||
A769B10123E259AE00872273 /* SDL_events_c.h in Headers */,
|
||||
A769B11123E259AE00872273 /* SDL_gamecontrollerdb.h in Headers */,
|
||||
A769B11123E259AE00872273 /* SDL_gamepad_db.h in Headers */,
|
||||
A769B16323E259AE00872273 /* SDL_gles2funcs.h in Headers */,
|
||||
A769B08E23E259AE00872273 /* SDL_glfuncs.h in Headers */,
|
||||
A769B09D23E259AE00872273 /* SDL_haptic_c.h in Headers */,
|
||||
@ -5736,8 +5736,8 @@
|
||||
F3F7D9722933074E00816151 /* SDL_events.h in Headers */,
|
||||
A7D8BBA623E2514500DCD162 /* SDL_events_c.h in Headers */,
|
||||
F3F7D99E2933074E00816151 /* SDL_filesystem.h in Headers */,
|
||||
F3F7D9862933074E00816151 /* SDL_gamecontroller.h in Headers */,
|
||||
A7D8B4AD23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */,
|
||||
F3F7D9862933074E00816151 /* SDL_gamepad.h in Headers */,
|
||||
A7D8B4AD23E2514300DCD162 /* SDL_gamepad_db.h in Headers */,
|
||||
A7D8BA5623E2514400DCD162 /* SDL_gles2funcs.h in Headers */,
|
||||
A7D8BA7A23E2514400DCD162 /* SDL_glfuncs.h in Headers */,
|
||||
F3F7D98A2933074E00816151 /* SDL_guid.h in Headers */,
|
||||
@ -5964,8 +5964,8 @@
|
||||
F3F7D9732933074E00816151 /* SDL_events.h in Headers */,
|
||||
A7D8BBA723E2514500DCD162 /* SDL_events_c.h in Headers */,
|
||||
F3F7D99F2933074E00816151 /* SDL_filesystem.h in Headers */,
|
||||
F3F7D9872933074E00816151 /* SDL_gamecontroller.h in Headers */,
|
||||
A7D8B4AE23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */,
|
||||
F3F7D9872933074E00816151 /* SDL_gamepad.h in Headers */,
|
||||
A7D8B4AE23E2514300DCD162 /* SDL_gamepad_db.h in Headers */,
|
||||
A7D8BA5723E2514400DCD162 /* SDL_gles2funcs.h in Headers */,
|
||||
A7D8BA7B23E2514400DCD162 /* SDL_glfuncs.h in Headers */,
|
||||
F3F7D98B2933074E00816151 /* SDL_guid.h in Headers */,
|
||||
@ -6178,7 +6178,7 @@
|
||||
A7D8ABDD23E2514100DCD162 /* SDL_egl_c.h in Headers */,
|
||||
A7D8A96123E2514000DCD162 /* SDL_error_c.h in Headers */,
|
||||
A7D8BBA923E2514500DCD162 /* SDL_events_c.h in Headers */,
|
||||
A7D8B4B023E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */,
|
||||
A7D8B4B023E2514300DCD162 /* SDL_gamepad_db.h in Headers */,
|
||||
A7D8BA5923E2514400DCD162 /* SDL_gles2funcs.h in Headers */,
|
||||
A7D8BA7D23E2514400DCD162 /* SDL_glfuncs.h in Headers */,
|
||||
A7D8AAC023E2514100DCD162 /* SDL_haptic_c.h in Headers */,
|
||||
@ -6357,8 +6357,8 @@
|
||||
F3F7D9712933074E00816151 /* SDL_events.h in Headers */,
|
||||
A7D8BBA523E2514500DCD162 /* SDL_events_c.h in Headers */,
|
||||
F3F7D99D2933074E00816151 /* SDL_filesystem.h in Headers */,
|
||||
F3F7D9852933074E00816151 /* SDL_gamecontroller.h in Headers */,
|
||||
A7D8B4AC23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */,
|
||||
F3F7D9852933074E00816151 /* SDL_gamepad.h in Headers */,
|
||||
A7D8B4AC23E2514300DCD162 /* SDL_gamepad_db.h in Headers */,
|
||||
A7D8BA5523E2514400DCD162 /* SDL_gles2funcs.h in Headers */,
|
||||
A7D8BA7923E2514400DCD162 /* SDL_glfuncs.h in Headers */,
|
||||
F3F7D9892933074E00816151 /* SDL_guid.h in Headers */,
|
||||
@ -6571,7 +6571,7 @@
|
||||
A7D8ABDC23E2514100DCD162 /* SDL_egl_c.h in Headers */,
|
||||
A7D8A96023E2514000DCD162 /* SDL_error_c.h in Headers */,
|
||||
A7D8BBA823E2514500DCD162 /* SDL_events_c.h in Headers */,
|
||||
A7D8B4AF23E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */,
|
||||
A7D8B4AF23E2514300DCD162 /* SDL_gamepad_db.h in Headers */,
|
||||
A7D8BA5823E2514400DCD162 /* SDL_gles2funcs.h in Headers */,
|
||||
A7D8BA7C23E2514400DCD162 /* SDL_glfuncs.h in Headers */,
|
||||
A7D8AABF23E2514100DCD162 /* SDL_haptic_c.h in Headers */,
|
||||
@ -6736,7 +6736,7 @@
|
||||
A7D8ABDE23E2514100DCD162 /* SDL_egl_c.h in Headers */,
|
||||
A7D8A96223E2514000DCD162 /* SDL_error_c.h in Headers */,
|
||||
A7D8BBAA23E2514500DCD162 /* SDL_events_c.h in Headers */,
|
||||
A7D8B4B123E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */,
|
||||
A7D8B4B123E2514300DCD162 /* SDL_gamepad_db.h in Headers */,
|
||||
A7D8BA5A23E2514400DCD162 /* SDL_gles2funcs.h in Headers */,
|
||||
A7D8BA7E23E2514400DCD162 /* SDL_glfuncs.h in Headers */,
|
||||
A7D8AAC123E2514100DCD162 /* SDL_haptic_c.h in Headers */,
|
||||
@ -6872,7 +6872,7 @@
|
||||
F3F7D9382933074E00816151 /* SDL_error.h in Headers */,
|
||||
F3F7D9742933074E00816151 /* SDL_events.h in Headers */,
|
||||
F3F7D9A02933074E00816151 /* SDL_filesystem.h in Headers */,
|
||||
F3F7D9882933074E00816151 /* SDL_gamecontroller.h in Headers */,
|
||||
F3F7D9882933074E00816151 /* SDL_gamepad.h in Headers */,
|
||||
F3F7D98C2933074E00816151 /* SDL_guid.h in Headers */,
|
||||
F3F7D8FC2933074E00816151 /* SDL_haptic.h in Headers */,
|
||||
F3F7D9702933074E00816151 /* SDL_hidapi.h in Headers */,
|
||||
@ -7346,7 +7346,7 @@
|
||||
A75FCE0923E25AB700529352 /* s_scalbn.c in Sources */,
|
||||
A75FCE0A23E25AB700529352 /* SDL_timer.c in Sources */,
|
||||
A75FCE0B23E25AB700529352 /* SDL_blendpoint.c in Sources */,
|
||||
A75FCE0C23E25AB700529352 /* SDL_gamecontroller.c in Sources */,
|
||||
A75FCE0C23E25AB700529352 /* SDL_gamepad.c in Sources */,
|
||||
A75FCE0D23E25AB700529352 /* SDL_systimer.c in Sources */,
|
||||
A75FCE0E23E25AB700529352 /* SDL_uikitclipboard.m in Sources */,
|
||||
A75FCE0F23E25AB700529352 /* SDL_render_sw.c in Sources */,
|
||||
@ -7541,7 +7541,7 @@
|
||||
A75FCFC223E25AC700529352 /* s_scalbn.c in Sources */,
|
||||
A75FCFC323E25AC700529352 /* SDL_timer.c in Sources */,
|
||||
A75FCFC423E25AC700529352 /* SDL_blendpoint.c in Sources */,
|
||||
A75FCFC523E25AC700529352 /* SDL_gamecontroller.c in Sources */,
|
||||
A75FCFC523E25AC700529352 /* SDL_gamepad.c in Sources */,
|
||||
A75FCFC623E25AC700529352 /* SDL_systimer.c in Sources */,
|
||||
A75FCFC723E25AC700529352 /* SDL_uikitclipboard.m in Sources */,
|
||||
A75FCFC823E25AC700529352 /* SDL_render_sw.c in Sources */,
|
||||
@ -7730,7 +7730,7 @@
|
||||
A769B19223E259AE00872273 /* s_scalbn.c in Sources */,
|
||||
A769B19323E259AE00872273 /* SDL_timer.c in Sources */,
|
||||
A769B19423E259AE00872273 /* SDL_blendpoint.c in Sources */,
|
||||
A769B19523E259AE00872273 /* SDL_gamecontroller.c in Sources */,
|
||||
A769B19523E259AE00872273 /* SDL_gamepad.c in Sources */,
|
||||
A769B19623E259AE00872273 /* SDL_systimer.c in Sources */,
|
||||
A769B19723E259AE00872273 /* SDL_uikitclipboard.m in Sources */,
|
||||
A769B19823E259AE00872273 /* SDL_render_sw.c in Sources */,
|
||||
@ -7929,7 +7929,7 @@
|
||||
A7D8BABC23E2514400DCD162 /* s_scalbn.c in Sources */,
|
||||
A7D8AB2C23E2514100DCD162 /* SDL_timer.c in Sources */,
|
||||
A7D8B9DE23E2514400DCD162 /* SDL_blendpoint.c in Sources */,
|
||||
A7D8B4EF23E2514300DCD162 /* SDL_gamecontroller.c in Sources */,
|
||||
A7D8B4EF23E2514300DCD162 /* SDL_gamepad.c in Sources */,
|
||||
A7D8AB3823E2514100DCD162 /* SDL_systimer.c in Sources */,
|
||||
A7D8ACAC23E2514100DCD162 /* SDL_uikitclipboard.m in Sources */,
|
||||
A7D8BA1423E2514400DCD162 /* SDL_render_sw.c in Sources */,
|
||||
@ -8124,7 +8124,7 @@
|
||||
A7D8BABD23E2514400DCD162 /* s_scalbn.c in Sources */,
|
||||
A7D8AB2D23E2514100DCD162 /* SDL_timer.c in Sources */,
|
||||
A7D8B9DF23E2514400DCD162 /* SDL_blendpoint.c in Sources */,
|
||||
A7D8B4F023E2514300DCD162 /* SDL_gamecontroller.c in Sources */,
|
||||
A7D8B4F023E2514300DCD162 /* SDL_gamepad.c in Sources */,
|
||||
A7D8AB3923E2514100DCD162 /* SDL_systimer.c in Sources */,
|
||||
A7D8ACAD23E2514100DCD162 /* SDL_uikitclipboard.m in Sources */,
|
||||
A7D8BA1523E2514400DCD162 /* SDL_render_sw.c in Sources */,
|
||||
@ -8315,7 +8315,7 @@
|
||||
A7D8BABF23E2514400DCD162 /* s_scalbn.c in Sources */,
|
||||
A7D8AB2F23E2514100DCD162 /* SDL_timer.c in Sources */,
|
||||
A7D8B9E123E2514400DCD162 /* SDL_blendpoint.c in Sources */,
|
||||
A7D8B4F223E2514300DCD162 /* SDL_gamecontroller.c in Sources */,
|
||||
A7D8B4F223E2514300DCD162 /* SDL_gamepad.c in Sources */,
|
||||
A7D8AB3B23E2514100DCD162 /* SDL_systimer.c in Sources */,
|
||||
A7D8ACAF23E2514100DCD162 /* SDL_uikitclipboard.m in Sources */,
|
||||
A7D8BA1723E2514400DCD162 /* SDL_render_sw.c in Sources */,
|
||||
@ -8520,7 +8520,7 @@
|
||||
A7D8AB2B23E2514100DCD162 /* SDL_timer.c in Sources */,
|
||||
F3D60A8328C16A1900788A3A /* SDL_hidapi_wii.c in Sources */,
|
||||
A7D8B9DD23E2514400DCD162 /* SDL_blendpoint.c in Sources */,
|
||||
A7D8B4EE23E2514300DCD162 /* SDL_gamecontroller.c in Sources */,
|
||||
A7D8B4EE23E2514300DCD162 /* SDL_gamepad.c in Sources */,
|
||||
A7D8AB3723E2514100DCD162 /* SDL_systimer.c in Sources */,
|
||||
A7D8BA1323E2514400DCD162 /* SDL_render_sw.c in Sources */,
|
||||
A7D8B42223E2514300DCD162 /* SDL_syssem.c in Sources */,
|
||||
@ -8716,7 +8716,7 @@
|
||||
A7D8BABE23E2514400DCD162 /* s_scalbn.c in Sources */,
|
||||
A7D8AB2E23E2514100DCD162 /* SDL_timer.c in Sources */,
|
||||
A7D8B9E023E2514400DCD162 /* SDL_blendpoint.c in Sources */,
|
||||
A7D8B4F123E2514300DCD162 /* SDL_gamecontroller.c in Sources */,
|
||||
A7D8B4F123E2514300DCD162 /* SDL_gamepad.c in Sources */,
|
||||
A7D8AB3A23E2514100DCD162 /* SDL_systimer.c in Sources */,
|
||||
A7D8BA1623E2514400DCD162 /* SDL_render_sw.c in Sources */,
|
||||
A7D8B42523E2514300DCD162 /* SDL_syssem.c in Sources */,
|
||||
@ -8908,7 +8908,7 @@
|
||||
A7D8AB3023E2514100DCD162 /* SDL_timer.c in Sources */,
|
||||
F3D60A8928C16A1900788A3A /* SDL_hidapi_wii.c in Sources */,
|
||||
A7D8B9E223E2514400DCD162 /* SDL_blendpoint.c in Sources */,
|
||||
A7D8B4F323E2514300DCD162 /* SDL_gamecontroller.c in Sources */,
|
||||
A7D8B4F323E2514300DCD162 /* SDL_gamepad.c in Sources */,
|
||||
A7D8AB3C23E2514100DCD162 /* SDL_systimer.c in Sources */,
|
||||
A7D8ACB023E2514100DCD162 /* SDL_uikitclipboard.m in Sources */,
|
||||
A7D8BA1823E2514400DCD162 /* SDL_render_sw.c in Sources */,
|
||||
|
@ -87,7 +87,7 @@
|
||||
453774A5120915E3002F0F45 /* testshape.c in Sources */ = {isa = PBXBuildFile; fileRef = 453774A4120915E3002F0F45 /* testshape.c */; };
|
||||
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 */; };
|
||||
BBFC08D0164C6876003E6A99 /* testgamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088E164C6820003E6A99 /* testgamecontroller.c */; };
|
||||
BBFC08D0164C6876003E6A99 /* testgamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088E164C6820003E6A99 /* testgamepad.c */; };
|
||||
BEC566B10761D90300A33029 /* checkkeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D10FFB30A2C7F000001 /* checkkeys.c */; };
|
||||
BEC566CB0761D90300A33029 /* loopwave.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4872006D84C97F000001 /* loopwave.c */; };
|
||||
BEC567010761D90300A33029 /* testerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4878006D85357F000001 /* testerror.c */; };
|
||||
@ -149,13 +149,13 @@
|
||||
DB445EF418184B7000B306B0 /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; };
|
||||
DB445EFB18184BB600B306B0 /* testdropfile.c in Sources */ = {isa = PBXBuildFile; fileRef = DB445EFA18184BB600B306B0 /* testdropfile.c */; };
|
||||
DB89958418A19B130092407C /* testhotplug.c in Sources */ = {isa = PBXBuildFile; fileRef = DB89958318A19B130092407C /* testhotplug.c */; };
|
||||
DBEC54EB1A1A8205005B1EAB /* controllermap.c in Sources */ = {isa = PBXBuildFile; fileRef = DBEC54D11A1A811D005B1EAB /* controllermap.c */; };
|
||||
DBEC54EB1A1A8205005B1EAB /* gamepadmap.c in Sources */ = {isa = PBXBuildFile; fileRef = DBEC54D11A1A811D005B1EAB /* gamepadmap.c */; };
|
||||
DBEC54ED1A1A828A005B1EAB /* axis.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D61A1A8145005B1EAB /* axis.bmp */; };
|
||||
DBEC54EE1A1A828D005B1EAB /* button.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D71A1A8145005B1EAB /* button.bmp */; };
|
||||
DBEC54EF1A1A828F005B1EAB /* controllermap.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D81A1A8145005B1EAB /* controllermap.bmp */; };
|
||||
DBEC54EF1A1A828F005B1EAB /* gamepadmap.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D81A1A8145005B1EAB /* gamepadmap.bmp */; };
|
||||
F3C17C6B28E4022A00E1A26D /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; };
|
||||
F3C17C7428E40AF000E1A26D /* testutils.c in Sources */ = {isa = PBXBuildFile; fileRef = F3C17C7328E40ADE00E1A26D /* testutils.c */; };
|
||||
F3C17C7628E40BA200E1A26D /* controllermap_back.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = F3C17C7528E40B6B00E1A26D /* controllermap_back.bmp */; };
|
||||
F3C17C7628E40BA200E1A26D /* gamepadmap_back.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = F3C17C7528E40B6B00E1A26D /* gamepadmap_back.bmp */; };
|
||||
F3C17C7728E40BC800E1A26D /* testutils.c in Sources */ = {isa = PBXBuildFile; fileRef = F3C17C7328E40ADE00E1A26D /* testutils.c */; };
|
||||
F3C17C7928E40C6E00E1A26D /* testutils.c in Sources */ = {isa = PBXBuildFile; fileRef = F3C17C7328E40ADE00E1A26D /* testutils.c */; };
|
||||
F3C17C7B28E40D4E00E1A26D /* testutils.c in Sources */ = {isa = PBXBuildFile; fileRef = F3C17C7328E40ADE00E1A26D /* testutils.c */; };
|
||||
@ -176,8 +176,8 @@
|
||||
F3C17D3B28E4252900E1A26D /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; };
|
||||
F3C17D3C28E4277D00E1A26D /* axis.bmp in Resources */ = {isa = PBXBuildFile; fileRef = DBEC54D61A1A8145005B1EAB /* axis.bmp */; };
|
||||
F3C17D3D28E4277D00E1A26D /* button.bmp in Resources */ = {isa = PBXBuildFile; fileRef = DBEC54D71A1A8145005B1EAB /* button.bmp */; };
|
||||
F3C17D3E28E4277D00E1A26D /* controllermap_back.bmp in Resources */ = {isa = PBXBuildFile; fileRef = F3C17C7528E40B6B00E1A26D /* controllermap_back.bmp */; };
|
||||
F3C17D3F28E4277D00E1A26D /* controllermap.bmp in Resources */ = {isa = PBXBuildFile; fileRef = DBEC54D81A1A8145005B1EAB /* controllermap.bmp */; };
|
||||
F3C17D3E28E4277D00E1A26D /* gamepadmap_back.bmp in Resources */ = {isa = PBXBuildFile; fileRef = F3C17C7528E40B6B00E1A26D /* gamepadmap_back.bmp */; };
|
||||
F3C17D3F28E4277D00E1A26D /* gamepadmap.bmp in Resources */ = {isa = PBXBuildFile; fileRef = DBEC54D81A1A8145005B1EAB /* gamepadmap.bmp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -424,7 +424,7 @@
|
||||
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = BBFC08B7164C6862003E6A99;
|
||||
remoteInfo = testgamecontroller;
|
||||
remoteInfo = testgamepad;
|
||||
};
|
||||
DB166D6F16A1CEAF00A1396C /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
@ -666,8 +666,8 @@
|
||||
files = (
|
||||
DBEC54ED1A1A828A005B1EAB /* axis.bmp in CopyFiles */,
|
||||
DBEC54EE1A1A828D005B1EAB /* button.bmp in CopyFiles */,
|
||||
DBEC54EF1A1A828F005B1EAB /* controllermap.bmp in CopyFiles */,
|
||||
F3C17C7628E40BA200E1A26D /* controllermap_back.bmp in CopyFiles */,
|
||||
DBEC54EF1A1A828F005B1EAB /* gamepadmap.bmp in CopyFiles */,
|
||||
F3C17C7628E40BA200E1A26D /* gamepadmap_back.bmp in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -735,8 +735,8 @@
|
||||
453774A4120915E3002F0F45 /* testshape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testshape.c; sourceTree = "<group>"; };
|
||||
66E88E8A203B778F0004D44E /* testyuv_cvt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testyuv_cvt.c; sourceTree = "<group>"; };
|
||||
AAF02FF41F90089800B9A9FB /* SDL_test_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_memory.c; sourceTree = "<group>"; };
|
||||
BBFC088E164C6820003E6A99 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgamecontroller.c; sourceTree = "<group>"; };
|
||||
BBFC08CD164C6862003E6A99 /* testgamecontroller */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testgamecontroller; path = testgamecontroller.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BBFC088E164C6820003E6A99 /* testgamepad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgamepad.c; sourceTree = "<group>"; };
|
||||
BBFC08CD164C6862003E6A99 /* testgamepad */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testgamepad; path = testgamepad.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BEC566B60761D90300A33029 /* checkkeys */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = checkkeys; path = checkkeys.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BEC566D10761D90300A33029 /* loopwave */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = loopwave; path = loopwave.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BEC567060761D90400A33029 /* testerror */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testerror; path = testerror.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@ -793,14 +793,14 @@
|
||||
DB89957E18A19ABA0092407C /* testhotplug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testhotplug; path = testhotplug.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DB89958318A19B130092407C /* testhotplug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testhotplug.c; sourceTree = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
DBEC54D11A1A811D005B1EAB /* gamepadmap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gamepadmap.c; sourceTree = "<group>"; };
|
||||
DBEC54D61A1A8145005B1EAB /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = axis.bmp; sourceTree = "<group>"; };
|
||||
DBEC54D71A1A8145005B1EAB /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = button.bmp; sourceTree = "<group>"; };
|
||||
DBEC54D81A1A8145005B1EAB /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = controllermap.bmp; sourceTree = "<group>"; };
|
||||
DBEC54EA1A1A81C3005B1EAB /* controllermap */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = controllermap; path = controllermap.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DBEC54D81A1A8145005B1EAB /* gamepadmap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = gamepadmap.bmp; sourceTree = "<group>"; };
|
||||
DBEC54EA1A1A81C3005B1EAB /* gamepadmap */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = gamepadmap; path = gamepadmap.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F3C17C6A28E3FD4400E1A26D /* config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = "<group>"; };
|
||||
F3C17C7328E40ADE00E1A26D /* testutils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testutils.c; sourceTree = "<group>"; };
|
||||
F3C17C7528E40B6B00E1A26D /* controllermap_back.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = controllermap_back.bmp; sourceTree = "<group>"; };
|
||||
F3C17C7528E40B6B00E1A26D /* gamepadmap_back.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = gamepadmap_back.bmp; sourceTree = "<group>"; };
|
||||
F3C17CD628E416AC00E1A26D /* testgeometry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgeometry.c; sourceTree = "<group>"; };
|
||||
F3C17CDC28E416CF00E1A26D /* testgeometry.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgeometry.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
@ -1175,8 +1175,8 @@
|
||||
children = (
|
||||
DBEC54D61A1A8145005B1EAB /* axis.bmp */,
|
||||
DBEC54D71A1A8145005B1EAB /* button.bmp */,
|
||||
F3C17C7528E40B6B00E1A26D /* controllermap_back.bmp */,
|
||||
DBEC54D81A1A8145005B1EAB /* controllermap.bmp */,
|
||||
F3C17C7528E40B6B00E1A26D /* gamepadmap_back.bmp */,
|
||||
DBEC54D81A1A8145005B1EAB /* gamepadmap.bmp */,
|
||||
00794E5D09D20839003FC8A1 /* icon.bmp */,
|
||||
00794E5E09D20839003FC8A1 /* moose.dat */,
|
||||
00794E5F09D20839003FC8A1 /* picture.xbm */,
|
||||
@ -1208,7 +1208,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
092D6D10FFB30A2C7F000001 /* checkkeys.c */,
|
||||
DBEC54D11A1A811D005B1EAB /* controllermap.c */,
|
||||
DBEC54D11A1A811D005B1EAB /* gamepadmap.c */,
|
||||
083E4872006D84C97F000001 /* loopwave.c */,
|
||||
0017958F1074216E00F5D044 /* testatomic.c */,
|
||||
001795B01074222D00F5D044 /* testaudioinfo.c */,
|
||||
@ -1218,7 +1218,7 @@
|
||||
083E4878006D85357F000001 /* testerror.c */,
|
||||
002F341709CA1C5B00EBEB88 /* testfile.c */,
|
||||
DB0F48D817CA51D2008798C5 /* testfilesystem.c */,
|
||||
BBFC088E164C6820003E6A99 /* testgamecontroller.c */,
|
||||
BBFC088E164C6820003E6A99 /* testgamepad.c */,
|
||||
F3C17CD628E416AC00E1A26D /* testgeometry.c */,
|
||||
0017972710742FB900F5D044 /* testgl2.c */,
|
||||
DB166CBC16A1C74100A1396C /* testgles.c */,
|
||||
@ -1297,7 +1297,7 @@
|
||||
0017991610743F1000F5D044 /* testsprite2 */,
|
||||
0017993810743FB700F5D044 /* testwm2 */,
|
||||
4537749212091504002F0F45 /* testshape */,
|
||||
BBFC08CD164C6862003E6A99 /* testgamecontroller */,
|
||||
BBFC08CD164C6862003E6A99 /* testgamepad */,
|
||||
DB166D7F16A1D12400A1396C /* libSDL_test.a */,
|
||||
DB166DD516A1D36A00A1396C /* testmessage */,
|
||||
DB166DEE16A1D50C00A1396C /* testrelative */,
|
||||
@ -1312,7 +1312,7 @@
|
||||
DB0F490117CA5212008798C5 /* testfilesystem */,
|
||||
DB89957E18A19ABA0092407C /* testhotplug */,
|
||||
DB445EF818184B7000B306B0 /* testdropfile.app */,
|
||||
DBEC54EA1A1A81C3005B1EAB /* controllermap */,
|
||||
DBEC54EA1A1A81C3005B1EAB /* gamepadmap */,
|
||||
F3C17CDC28E416CF00E1A26D /* testgeometry.app */,
|
||||
);
|
||||
name = Products;
|
||||
@ -1665,9 +1665,9 @@
|
||||
productReference = 4537749212091504002F0F45 /* testshape */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
BBFC08B7164C6862003E6A99 /* testgamecontroller */ = {
|
||||
BBFC08B7164C6862003E6A99 /* testgamepad */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = BBFC08CA164C6862003E6A99 /* Build configuration list for PBXNativeTarget "testgamecontroller" */;
|
||||
buildConfigurationList = BBFC08CA164C6862003E6A99 /* Build configuration list for PBXNativeTarget "testgamepad" */;
|
||||
buildPhases = (
|
||||
BBFC08BC164C6862003E6A99 /* Sources */,
|
||||
BBFC08BE164C6862003E6A99 /* Frameworks */,
|
||||
@ -1677,9 +1677,9 @@
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = testgamecontroller;
|
||||
name = testgamepad;
|
||||
productName = testjoystick;
|
||||
productReference = BBFC08CD164C6862003E6A99 /* testgamecontroller */;
|
||||
productReference = BBFC08CD164C6862003E6A99 /* testgamepad */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
BEC566AB0761D90300A33029 /* checkkeys */ = {
|
||||
@ -2089,9 +2089,9 @@
|
||||
productReference = DB89957E18A19ABA0092407C /* testhotplug */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
DBEC54D91A1A81C3005B1EAB /* controllermap */ = {
|
||||
DBEC54D91A1A81C3005B1EAB /* gamepadmap */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = DBEC54E71A1A81C3005B1EAB /* Build configuration list for PBXNativeTarget "controllermap" */;
|
||||
buildConfigurationList = DBEC54E71A1A81C3005B1EAB /* Build configuration list for PBXNativeTarget "gamepadmap" */;
|
||||
buildPhases = (
|
||||
DBEC54DA1A1A81C3005B1EAB /* Sources */,
|
||||
DBEC54DC1A1A81C3005B1EAB /* Frameworks */,
|
||||
@ -2101,9 +2101,9 @@
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = controllermap;
|
||||
name = gamepadmap;
|
||||
productName = checkkeys;
|
||||
productReference = DBEC54EA1A1A81C3005B1EAB /* controllermap */;
|
||||
productReference = DBEC54EA1A1A81C3005B1EAB /* gamepadmap */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
F3C17CDB28E416CF00E1A26D /* testgeometry */ = {
|
||||
@ -2161,7 +2161,7 @@
|
||||
BEC566920761D90300A33029 /* All */,
|
||||
DB166D7E16A1D12400A1396C /* SDL_test */,
|
||||
BEC566AB0761D90300A33029 /* checkkeys */,
|
||||
DBEC54D91A1A81C3005B1EAB /* controllermap */,
|
||||
DBEC54D91A1A81C3005B1EAB /* gamepadmap */,
|
||||
BEC566C50761D90300A33029 /* loopwave */,
|
||||
0017957410741F7900F5D044 /* testatomic */,
|
||||
00179595107421BF00F5D044 /* testaudioinfo */,
|
||||
@ -2171,7 +2171,7 @@
|
||||
BEC566FB0761D90300A33029 /* testerror */,
|
||||
002F340109CA1BFF00EBEB88 /* testfile */,
|
||||
DB0F48EF17CA5212008798C5 /* testfilesystem */,
|
||||
BBFC08B7164C6862003E6A99 /* testgamecontroller */,
|
||||
BBFC08B7164C6862003E6A99 /* testgamepad */,
|
||||
F3C17CDB28E416CF00E1A26D /* testgeometry */,
|
||||
0017970910742F3200F5D044 /* testgl2 */,
|
||||
00179730107430D600F5D044 /* testhaptic */,
|
||||
@ -2297,8 +2297,8 @@
|
||||
files = (
|
||||
F3C17D3C28E4277D00E1A26D /* axis.bmp in Resources */,
|
||||
F3C17D3D28E4277D00E1A26D /* button.bmp in Resources */,
|
||||
F3C17D3E28E4277D00E1A26D /* controllermap_back.bmp in Resources */,
|
||||
F3C17D3F28E4277D00E1A26D /* controllermap.bmp in Resources */,
|
||||
F3C17D3E28E4277D00E1A26D /* gamepadmap_back.bmp in Resources */,
|
||||
F3C17D3F28E4277D00E1A26D /* gamepadmap.bmp in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -2485,7 +2485,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BBFC08D0164C6876003E6A99 /* testgamecontroller.c in Sources */,
|
||||
BBFC08D0164C6876003E6A99 /* testgamepad.c in Sources */,
|
||||
F3C17C7928E40C6E00E1A26D /* testutils.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -2715,7 +2715,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
DBEC54EB1A1A8205005B1EAB /* controllermap.c in Sources */,
|
||||
DBEC54EB1A1A8205005B1EAB /* gamepadmap.c in Sources */,
|
||||
F3C17C7428E40AF000E1A26D /* testutils.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -2889,7 +2889,7 @@
|
||||
};
|
||||
DB166D6E16A1CEAA00A1396C /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = BBFC08B7164C6862003E6A99 /* testgamecontroller */;
|
||||
target = BBFC08B7164C6862003E6A99 /* testgamepad */;
|
||||
targetProxy = DB166D6D16A1CEAA00A1396C /* PBXContainerItemProxy */;
|
||||
};
|
||||
DB166D7016A1CEAF00A1396C /* PBXTargetDependency */ = {
|
||||
@ -3441,14 +3441,14 @@
|
||||
BBFC08CB164C6862003E6A99 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = testgamecontroller;
|
||||
PRODUCT_NAME = testgamepad;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
BBFC08CC164C6862003E6A99 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = testgamecontroller;
|
||||
PRODUCT_NAME = testgamepad;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -3661,14 +3661,14 @@
|
||||
DBEC54E81A1A81C3005B1EAB /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = controllermap;
|
||||
PRODUCT_NAME = gamepadmap;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
DBEC54E91A1A81C3005B1EAB /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = controllermap;
|
||||
PRODUCT_NAME = gamepadmap;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -3977,7 +3977,7 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Debug;
|
||||
};
|
||||
BBFC08CA164C6862003E6A99 /* Build configuration list for PBXNativeTarget "testgamecontroller" */ = {
|
||||
BBFC08CA164C6862003E6A99 /* Build configuration list for PBXNativeTarget "testgamepad" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BBFC08CB164C6862003E6A99 /* Debug */,
|
||||
@ -4112,7 +4112,7 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Debug;
|
||||
};
|
||||
DBEC54E71A1A81C3005B1EAB /* Build configuration list for PBXNativeTarget "controllermap" */ = {
|
||||
DBEC54E71A1A81C3005B1EAB /* Build configuration list for PBXNativeTarget "gamepadmap" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
DBEC54E81A1A81C3005B1EAB /* Debug */,
|
||||
|
@ -18,7 +18,7 @@ SDL_INCLUDE_DIR = SDL_ROOT / "include/SDL3"
|
||||
|
||||
def main():
|
||||
if len(args.args) == 0 or (len(args.args) % 2) != 0:
|
||||
print("Usage: %s [-h] [--skip-header-check] header {enum,function,macro,structure,symbol} [old new ...]" % sys.argv[0])
|
||||
print("Usage: %s [-h] [--skip-header-check] header {enum,function,hint,macro,structure,symbol} [old new ...]" % sys.argv[0])
|
||||
exit(1)
|
||||
|
||||
# Check whether we can still modify the ABI
|
||||
@ -229,7 +229,7 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
|
||||
parser.add_argument("--skip-header-check", action="store_true")
|
||||
parser.add_argument("header");
|
||||
parser.add_argument("type", choices=["enum", "function", "macro", "structure", "symbol"]);
|
||||
parser.add_argument("type", choices=["enum", "function", "hint", "macro", "structure", "symbol"]);
|
||||
parser.add_argument("args", nargs="*")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -89,9 +89,150 @@ The `SDL_DISPLAYEVENT_*` events have been moved to top level events, and `SDL_DI
|
||||
The `SDL_WINDOWEVENT_*` events have been moved to top level events, and `SDL_WINDOWEVENT` has been removed. In general, handling this change just means checking for the individual events instead of first checking for `SDL_WINDOWEVENT` and then checking for window events. You can compare the event >= `SDL_WINDOWEVENT_FIRST` and <= `SDL_WINDOWEVENT_LAST` if you need to see whether it's a window event.
|
||||
|
||||
|
||||
The following symbols have been renamed:
|
||||
* SDL_CONTROLLERAXISMOTION => SDL_GAMEPADAXISMOTION
|
||||
* SDL_CONTROLLERBUTTONDOWN => SDL_GAMEPADBUTTONDOWN
|
||||
* SDL_CONTROLLERBUTTONUP => SDL_GAMEPADBUTTONUP
|
||||
* SDL_CONTROLLERDEVICEADDED => SDL_GAMEPADADDED
|
||||
* SDL_CONTROLLERDEVICEREMAPPED => SDL_GAMEPADDEVICEREMAPPED
|
||||
* SDL_CONTROLLERDEVICEREMOVED => SDL_GAMEPADREMOVED
|
||||
* SDL_CONTROLLERSENSORUPDATE => SDL_GAMEPADSENSORUPDATE
|
||||
* SDL_CONTROLLERTOUCHPADDOWN => SDL_GAMEPADTOUCHPADDOWN
|
||||
* SDL_CONTROLLERTOUCHPADMOTION => SDL_GAMEPADTOUCHPADMOTION
|
||||
* SDL_CONTROLLERTOUCHPADUP => SDL_GAMEPADTOUCHPADUP
|
||||
|
||||
The following structures have been renamed:
|
||||
* SDL_ControllerAxisEvent => SDL_GamepadAxisEvent
|
||||
* SDL_ControllerButtonEvent => SDL_GamepadButtonEvent
|
||||
* SDL_ControllerDeviceEvent => SDL_GamepadDeviceEvent
|
||||
* SDL_ControllerSensorEvent => SDL_GamepadSensorEvent
|
||||
* SDL_ControllerTouchpadEvent => SDL_GamepadTouchpadEvent
|
||||
|
||||
## SDL_gamecontroller.h
|
||||
|
||||
Removed SDL_GameControllerGetSensorDataWithTimestamp(), if you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_CONTROLLERSENSORUPDATE events.
|
||||
SDL_gamecontroller.h has been renamed SDL_gamepad.h, and all APIs have been renamed to match.
|
||||
|
||||
Removed SDL_GameControllerGetSensorDataWithTimestamp(), if you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_GAMEPADSENSORUPDATE events.
|
||||
|
||||
The following enums have been renamed:
|
||||
* SDL_GameControllerAxis => SDL_GamepadAxis
|
||||
* SDL_GameControllerBindType => SDL_GamepadBindingType
|
||||
* SDL_GameControllerButton => SDL_GamepadButton
|
||||
* SDL_GameControllerType => SDL_GamepadType
|
||||
|
||||
The following structures have been renamed:
|
||||
* SDL_GameController => SDL_Gamepad
|
||||
* SDL_GameControllerButtonBind => SDL_GamepadBinding
|
||||
|
||||
The following functions have been renamed:
|
||||
* SDL_GameControllerAddMapping => SDL_AddGamepadMapping
|
||||
* SDL_GameControllerAddMappingsFromFile => SDL_AddGamepadMappingsFromFile
|
||||
* SDL_GameControllerAddMappingsFromRW => SDL_AddGamepadMappingsFromRW
|
||||
* SDL_GameControllerClose => SDL_CloseGamepad
|
||||
* SDL_GameControllerEventState => SDL_GetGamepadEventState
|
||||
* SDL_GameControllerFromInstanceID => SDL_GetGamepadFromInstanceID
|
||||
* SDL_GameControllerFromPlayerIndex => SDL_GetGamepadFromPlayerIndex
|
||||
* SDL_GameControllerGetAppleSFSymbolsNameForAxis => SDL_GetGamepadAppleSFSymbolsNameForAxis
|
||||
* SDL_GameControllerGetAppleSFSymbolsNameForButton => SDL_GetGamepadAppleSFSymbolsNameForButton
|
||||
* SDL_GameControllerGetAttached => SDL_IsGamepadConnected
|
||||
* SDL_GameControllerGetAxis => SDL_GetGamepadAxis
|
||||
* SDL_GameControllerGetAxisFromString => SDL_GetGamepadAxisFromString
|
||||
* SDL_GameControllerGetBindForAxis => SDL_GetGamepadBindForAxis
|
||||
* SDL_GameControllerGetBindForButton => SDL_GetGamepadBindForButton
|
||||
* SDL_GameControllerGetButton => SDL_GetGamepadButton
|
||||
* SDL_GameControllerGetButtonFromString => SDL_GetGamepadButtonFromString
|
||||
* SDL_GameControllerGetFirmwareVersion => SDL_GetGamepadFirmwareVersion
|
||||
* SDL_GameControllerGetJoystick => SDL_GetGamepadJoystick
|
||||
* SDL_GameControllerGetNumTouchpadFingers => SDL_GetGamepadNumTouchpadFingers
|
||||
* SDL_GameControllerGetNumTouchpads => SDL_GetGamepadNumTouchpads
|
||||
* SDL_GameControllerGetPlayerIndex => SDL_GetGamepadPlayerIndex
|
||||
* SDL_GameControllerGetProduct => SDL_GetGamepadProduct
|
||||
* SDL_GameControllerGetProductVersion => SDL_GetGamepadProductVersion
|
||||
* SDL_GameControllerGetSensorData => SDL_GetGamepadSensorData
|
||||
* SDL_GameControllerGetSensorDataRate => SDL_GetGamepadSensorDataRate
|
||||
* SDL_GameControllerGetSerial => SDL_GetGamepadSerial
|
||||
* SDL_GameControllerGetStringForAxis => SDL_GetGamepadStringForAxis
|
||||
* SDL_GameControllerGetStringForButton => SDL_GetGamepadStringForButton
|
||||
* SDL_GameControllerGetTouchpadFinger => SDL_GetGamepadTouchpadFinger
|
||||
* SDL_GameControllerGetType => SDL_GetGamepadType
|
||||
* SDL_GameControllerGetVendor => SDL_GetGamepadVendor
|
||||
* SDL_GameControllerHasAxis => SDL_GamepadHasAxis
|
||||
* SDL_GameControllerHasButton => SDL_GamepadHasButton
|
||||
* SDL_GameControllerHasLED => SDL_GamepadHasLED
|
||||
* SDL_GameControllerHasRumble => SDL_GamepadHasRumble
|
||||
* SDL_GameControllerHasRumbleTriggers => SDL_GamepadHasRumbleTriggers
|
||||
* SDL_GameControllerHasSensor => SDL_GamepadHasSensor
|
||||
* SDL_GameControllerIsSensorEnabled => SDL_IsGamepadSensorEnabled
|
||||
* SDL_GameControllerMapping => SDL_GetGamepadMapping
|
||||
* SDL_GameControllerMappingForDeviceIndex => SDL_GetGamepadMappingForDeviceIndex
|
||||
* SDL_GameControllerMappingForGUID => SDL_GetGamepadMappingForGUID
|
||||
* SDL_GameControllerMappingForIndex => SDL_GetGamepadMappingForIndex
|
||||
* SDL_GameControllerName => SDL_GetGamepadName
|
||||
* SDL_GameControllerNameForIndex => SDL_GetGamepadNameForIndex
|
||||
* SDL_GameControllerNumMappings => SDL_GetNumGamepadMappings
|
||||
* SDL_GameControllerOpen => SDL_OpenGamepad
|
||||
* SDL_GameControllerPath => SDL_GetGamepadPath
|
||||
* SDL_GameControllerPathForIndex => SDL_GetGamepadPathForIndex
|
||||
* SDL_GameControllerRumble => SDL_RumbleGamepad
|
||||
* SDL_GameControllerRumbleTriggers => SDL_RumbleGamepadTriggers
|
||||
* SDL_GameControllerSendEffect => SDL_SendGamepadEffect
|
||||
* SDL_GameControllerSetLED => SDL_SetGamepadLED
|
||||
* SDL_GameControllerSetPlayerIndex => SDL_SetGamepadPlayerIndex
|
||||
* SDL_GameControllerSetSensorEnabled => SDL_SetGamepadSensorEnabled
|
||||
* SDL_GameControllerTypeForIndex => SDL_GetGamepadTypeForIndex
|
||||
* SDL_GameControllerUpdate => SDL_UpdateGamepads
|
||||
* SDL_IsGameController => SDL_IsGamepad
|
||||
|
||||
The following symbols have been renamed:
|
||||
* SDL_CONTROLLER_AXIS_INVALID => SDL_GAMEPAD_AXIS_INVALID
|
||||
* SDL_CONTROLLER_AXIS_LEFTX => SDL_GAMEPAD_AXIS_LEFTX
|
||||
* SDL_CONTROLLER_AXIS_LEFTY => SDL_GAMEPAD_AXIS_LEFTY
|
||||
* SDL_CONTROLLER_AXIS_MAX => SDL_GAMEPAD_AXIS_MAX
|
||||
* SDL_CONTROLLER_AXIS_RIGHTX => SDL_GAMEPAD_AXIS_RIGHTX
|
||||
* SDL_CONTROLLER_AXIS_RIGHTY => SDL_GAMEPAD_AXIS_RIGHTY
|
||||
* SDL_CONTROLLER_AXIS_TRIGGERLEFT => SDL_GAMEPAD_AXIS_LEFT_TRIGGER
|
||||
* SDL_CONTROLLER_AXIS_TRIGGERRIGHT => SDL_GAMEPAD_AXIS_RIGHT_TRIGGER
|
||||
* SDL_CONTROLLER_BINDTYPE_AXIS => SDL_GAMEPAD_BINDTYPE_AXIS
|
||||
* SDL_CONTROLLER_BINDTYPE_BUTTON => SDL_GAMEPAD_BINDTYPE_BUTTON
|
||||
* SDL_CONTROLLER_BINDTYPE_HAT => SDL_GAMEPAD_BINDTYPE_HAT
|
||||
* SDL_CONTROLLER_BINDTYPE_NONE => SDL_GAMEPAD_BINDTYPE_NONE
|
||||
* SDL_CONTROLLER_BUTTON_A => SDL_GAMEPAD_BUTTON_A
|
||||
* SDL_CONTROLLER_BUTTON_B => SDL_GAMEPAD_BUTTON_B
|
||||
* SDL_CONTROLLER_BUTTON_BACK => SDL_GAMEPAD_BUTTON_BACK
|
||||
* SDL_CONTROLLER_BUTTON_DPAD_DOWN => SDL_GAMEPAD_BUTTON_DPAD_DOWN
|
||||
* SDL_CONTROLLER_BUTTON_DPAD_LEFT => SDL_GAMEPAD_BUTTON_DPAD_LEFT
|
||||
* SDL_CONTROLLER_BUTTON_DPAD_RIGHT => SDL_GAMEPAD_BUTTON_DPAD_RIGHT
|
||||
* SDL_CONTROLLER_BUTTON_DPAD_UP => SDL_GAMEPAD_BUTTON_DPAD_UP
|
||||
* SDL_CONTROLLER_BUTTON_GUIDE => SDL_GAMEPAD_BUTTON_GUIDE
|
||||
* SDL_CONTROLLER_BUTTON_INVALID => SDL_GAMEPAD_BUTTON_INVALID
|
||||
* SDL_CONTROLLER_BUTTON_LEFTSHOULDER => SDL_GAMEPAD_BUTTON_LEFT_SHOULDER
|
||||
* SDL_CONTROLLER_BUTTON_LEFTSTICK => SDL_GAMEPAD_BUTTON_LEFT_STICK
|
||||
* SDL_CONTROLLER_BUTTON_MAX => SDL_GAMEPAD_BUTTON_MAX
|
||||
* SDL_CONTROLLER_BUTTON_MISC1 => SDL_GAMEPAD_BUTTON_MISC1
|
||||
* SDL_CONTROLLER_BUTTON_PADDLE1 => SDL_GAMEPAD_BUTTON_PADDLE1
|
||||
* SDL_CONTROLLER_BUTTON_PADDLE2 => SDL_GAMEPAD_BUTTON_PADDLE2
|
||||
* SDL_CONTROLLER_BUTTON_PADDLE3 => SDL_GAMEPAD_BUTTON_PADDLE3
|
||||
* SDL_CONTROLLER_BUTTON_PADDLE4 => SDL_GAMEPAD_BUTTON_PADDLE4
|
||||
* SDL_CONTROLLER_BUTTON_RIGHTSHOULDER => SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER
|
||||
* SDL_CONTROLLER_BUTTON_RIGHTSTICK => SDL_GAMEPAD_BUTTON_RIGHT_STICK
|
||||
* SDL_CONTROLLER_BUTTON_START => SDL_GAMEPAD_BUTTON_START
|
||||
* SDL_CONTROLLER_BUTTON_TOUCHPAD => SDL_GAMEPAD_BUTTON_TOUCHPAD
|
||||
* SDL_CONTROLLER_BUTTON_X => SDL_GAMEPAD_BUTTON_X
|
||||
* SDL_CONTROLLER_BUTTON_Y => SDL_GAMEPAD_BUTTON_Y
|
||||
* SDL_CONTROLLER_TYPE_AMAZON_LUNA => SDL_GAMEPAD_TYPE_AMAZON_LUNA
|
||||
* SDL_CONTROLLER_TYPE_GOOGLE_STADIA => SDL_GAMEPAD_TYPE_GOOGLE_STADIA
|
||||
* SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT => SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT
|
||||
* SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR => SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
|
||||
* SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT => SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT
|
||||
* SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO => SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO
|
||||
* SDL_CONTROLLER_TYPE_NVIDIA_SHIELD => SDL_GAMEPAD_TYPE_NVIDIA_SHIELD
|
||||
* SDL_CONTROLLER_TYPE_PS3 => SDL_GAMEPAD_TYPE_PS3
|
||||
* SDL_CONTROLLER_TYPE_PS4 => SDL_GAMEPAD_TYPE_PS4
|
||||
* SDL_CONTROLLER_TYPE_PS5 => SDL_GAMEPAD_TYPE_PS5
|
||||
* SDL_CONTROLLER_TYPE_UNKNOWN => SDL_GAMEPAD_TYPE_UNKNOWN
|
||||
* SDL_CONTROLLER_TYPE_VIRTUAL => SDL_GAMEPAD_TYPE_VIRTUAL
|
||||
* SDL_CONTROLLER_TYPE_XBOX360 => SDL_GAMEPAD_TYPE_XBOX360
|
||||
* SDL_CONTROLLER_TYPE_XBOXONE => SDL_GAMEPAD_TYPE_XBOXONE
|
||||
|
||||
## SDL_gesture.h
|
||||
|
||||
@ -112,6 +253,11 @@ The following hints have been removed:
|
||||
* Renamed hints 'SDL_HINT_VIDEODRIVER' and 'SDL_HINT_AUDIODRIVER' to 'SDL_HINT_VIDEO_DRIVER' and 'SDL_HINT_AUDIO_DRIVER'
|
||||
* Renamed environment variables 'SDL_VIDEODRIVER' and 'SDL_AUDIODRIVER' to 'SDL_VIDEO_DRIVER' and 'SDL_AUDIO_DRIVER'
|
||||
|
||||
## SDL_init.h
|
||||
|
||||
The following macros have been renamed:
|
||||
* SDL_INIT_GAMECONTROLLER => SDL_INIT_GAMEPAD
|
||||
|
||||
## SDL_joystick.h
|
||||
|
||||
The following functions have been renamed:
|
||||
@ -168,7 +314,7 @@ The following functions have been renamed:
|
||||
|
||||
## SDL_keycode.h
|
||||
|
||||
The following enums have been renamed:
|
||||
The following symbols have been renamed:
|
||||
* KMOD_ALT => SDL_KMOD_ALT
|
||||
* KMOD_CAPS => SDL_KMOD_CAPS
|
||||
* KMOD_CTRL => SDL_KMOD_CTRL
|
||||
|
@ -52,7 +52,7 @@ Here is a rough list of what works, and what doesn't:
|
||||
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
|
||||
SDL_Gamepad 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.)
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
#include <SDL3/SDL_gamecontroller.h>
|
||||
#include <SDL3/SDL_gamepad.h>
|
||||
#include <SDL3/SDL_guid.h>
|
||||
#include <SDL3/SDL_haptic.h>
|
||||
#include <SDL3/SDL_hidapi.h>
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <SDL3/SDL_keyboard.h>
|
||||
#include <SDL3/SDL_mouse.h>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
#include <SDL3/SDL_gamecontroller.h>
|
||||
#include <SDL3/SDL_gamepad.h>
|
||||
#include <SDL3/SDL_quit.h>
|
||||
#include <SDL3/SDL_touch.h>
|
||||
|
||||
@ -149,17 +149,17 @@ typedef enum
|
||||
SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
|
||||
SDL_JOYBATTERYUPDATED, /**< Joystick battery level change */
|
||||
|
||||
/* Game controller events */
|
||||
SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
|
||||
SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */
|
||||
SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
|
||||
SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
|
||||
SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
|
||||
SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
|
||||
SDL_CONTROLLERTOUCHPADDOWN, /**< Game controller touchpad was touched */
|
||||
SDL_CONTROLLERTOUCHPADMOTION, /**< Game controller touchpad finger was moved */
|
||||
SDL_CONTROLLERTOUCHPADUP, /**< Game controller touchpad finger was lifted */
|
||||
SDL_CONTROLLERSENSORUPDATE, /**< Game controller sensor was updated */
|
||||
/* Gamepad events */
|
||||
SDL_GAMEPADAXISMOTION = 0x650, /**< Gamepad axis motion */
|
||||
SDL_GAMEPADBUTTONDOWN, /**< Gamepad button pressed */
|
||||
SDL_GAMEPADBUTTONUP, /**< Gamepad button released */
|
||||
SDL_GAMEPADADDED, /**< A new Gamepad has been inserted into the system */
|
||||
SDL_GAMEPADREMOVED, /**< An opened Gamepad has been removed */
|
||||
SDL_GAMEPADDEVICEREMAPPED, /**< The gamepad mapping was updated */
|
||||
SDL_GAMEPADTOUCHPADDOWN, /**< Gamepad touchpad was touched */
|
||||
SDL_GAMEPADTOUCHPADMOTION, /**< Gamepad touchpad finger was moved */
|
||||
SDL_GAMEPADTOUCHPADUP, /**< Gamepad touchpad finger was lifted */
|
||||
SDL_GAMEPADSENSORUPDATE, /**< Gamepad sensor was updated */
|
||||
|
||||
/* Touch events */
|
||||
SDL_FINGERDOWN = 0x700,
|
||||
@ -412,53 +412,53 @@ typedef struct SDL_JoyBatteryEvent
|
||||
} SDL_JoyBatteryEvent;
|
||||
|
||||
/**
|
||||
* \brief Game controller axis motion event structure (event.caxis.*)
|
||||
* \brief Gamepad axis motion event structure (event.caxis.*)
|
||||
*/
|
||||
typedef struct SDL_ControllerAxisEvent
|
||||
typedef struct SDL_GamepadAxisEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
|
||||
Uint32 type; /**< ::SDL_GAMEPADAXISMOTION */
|
||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
|
||||
Uint8 axis; /**< The gamepad axis (SDL_GamepadAxis) */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
Uint8 padding3;
|
||||
Sint16 value; /**< The axis value (range: -32768 to 32767) */
|
||||
Uint16 padding4;
|
||||
} SDL_ControllerAxisEvent;
|
||||
} SDL_GamepadAxisEvent;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Game controller button event structure (event.cbutton.*)
|
||||
* \brief Gamepad button event structure (event.cbutton.*)
|
||||
*/
|
||||
typedef struct SDL_ControllerButtonEvent
|
||||
typedef struct SDL_GamepadButtonEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
|
||||
Uint32 type; /**< ::SDL_GAMEPADBUTTONDOWN or ::SDL_GAMEPADBUTTONUP */
|
||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Uint8 button; /**< The controller button (SDL_GameControllerButton) */
|
||||
Uint8 button; /**< The gamepad button (SDL_GamepadButton) */
|
||||
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
|
||||
Uint8 padding1;
|
||||
Uint8 padding2;
|
||||
} SDL_ControllerButtonEvent;
|
||||
} SDL_GamepadButtonEvent;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Controller device event structure (event.cdevice.*)
|
||||
* \brief Gamepad device event structure (event.cdevice.*)
|
||||
*/
|
||||
typedef struct SDL_ControllerDeviceEvent
|
||||
typedef struct SDL_GamepadDeviceEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
|
||||
Uint32 type; /**< ::SDL_GAMEPADADDED, ::SDL_GAMEPADREMOVED, or ::SDL_GAMEPADDEVICEREMAPPED */
|
||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||
SDL_JoystickID which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
|
||||
} SDL_ControllerDeviceEvent;
|
||||
} SDL_GamepadDeviceEvent;
|
||||
|
||||
/**
|
||||
* \brief Game controller touchpad event structure (event.ctouchpad.*)
|
||||
* \brief Gamepad touchpad event structure (event.ctouchpad.*)
|
||||
*/
|
||||
typedef struct SDL_ControllerTouchpadEvent
|
||||
typedef struct SDL_GamepadTouchpadEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERTOUCHPADDOWN or ::SDL_CONTROLLERTOUCHPADMOTION or ::SDL_CONTROLLERTOUCHPADUP */
|
||||
Uint32 type; /**< ::SDL_GAMEPADTOUCHPADDOWN or ::SDL_GAMEPADTOUCHPADMOTION or ::SDL_GAMEPADTOUCHPADUP */
|
||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Sint32 touchpad; /**< The index of the touchpad */
|
||||
@ -466,20 +466,20 @@ typedef struct SDL_ControllerTouchpadEvent
|
||||
float x; /**< Normalized in the range 0...1 with 0 being on the left */
|
||||
float y; /**< Normalized in the range 0...1 with 0 being at the top */
|
||||
float pressure; /**< Normalized in the range 0...1 */
|
||||
} SDL_ControllerTouchpadEvent;
|
||||
} SDL_GamepadTouchpadEvent;
|
||||
|
||||
/**
|
||||
* \brief Game controller sensor event structure (event.csensor.*)
|
||||
* \brief Gamepad sensor event structure (event.csensor.*)
|
||||
*/
|
||||
typedef struct SDL_ControllerSensorEvent
|
||||
typedef struct SDL_GamepadSensorEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_CONTROLLERSENSORUPDATE */
|
||||
Uint32 type; /**< ::SDL_GAMEPADSENSORUPDATE */
|
||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||
SDL_JoystickID which; /**< The joystick instance id */
|
||||
Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */
|
||||
float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
|
||||
Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
|
||||
} SDL_ControllerSensorEvent;
|
||||
} SDL_GamepadSensorEvent;
|
||||
|
||||
/**
|
||||
* \brief Audio device event structure (event.adevice.*)
|
||||
@ -609,11 +609,11 @@ typedef union SDL_Event
|
||||
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
|
||||
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
|
||||
SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */
|
||||
SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
|
||||
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
|
||||
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
|
||||
SDL_ControllerTouchpadEvent ctouchpad; /**< Game Controller touchpad event data */
|
||||
SDL_ControllerSensorEvent csensor; /**< Game Controller sensor event data */
|
||||
SDL_GamepadAxisEvent caxis; /**< Gamepad axis event data */
|
||||
SDL_GamepadButtonEvent cbutton; /**< Gamepad button event data */
|
||||
SDL_GamepadDeviceEvent cdevice; /**< Gamepad device event data */
|
||||
SDL_GamepadTouchpadEvent ctouchpad; /**< Gamepad touchpad event data */
|
||||
SDL_GamepadSensorEvent csensor; /**< Gamepad sensor event data */
|
||||
SDL_AudioDeviceEvent adevice; /**< Audio device event data */
|
||||
SDL_SensorEvent sensor; /**< Sensor event data */
|
||||
SDL_QuitEvent quit; /**< Quit request event data */
|
||||
|
File diff suppressed because it is too large
Load Diff
1013
include/SDL3/SDL_gamepad.h
Normal file
1013
include/SDL3/SDL_gamepad.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -452,20 +452,20 @@ extern "C" {
|
||||
/**
|
||||
* \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
|
||||
* The variable should be newline delimited rows of gamecontroller config data, see SDL_gamepad.h
|
||||
*
|
||||
* This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
|
||||
* You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
|
||||
* This hint must be set before calling SDL_Init(SDL_INIT_GAMEPAD)
|
||||
* You can update mappings after the system is initialized with SDL_GetGamepadMappingForGUID() and SDL_AddGamepadMapping()
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
|
||||
|
||||
/**
|
||||
* \brief A variable that lets you provide a file with extra gamecontroller db entries.
|
||||
*
|
||||
* The file should contain lines of gamecontroller config data, see SDL_gamecontroller.h
|
||||
* The file should contain lines of gamecontroller config data, see SDL_gamepad.h
|
||||
*
|
||||
* This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
|
||||
* You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
|
||||
* This hint must be set before calling SDL_Init(SDL_INIT_GAMEPAD)
|
||||
* You can update mappings after the system is initialized with SDL_GetGamepadMappingForGUID() and SDL_AddGamepadMapping()
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLERCONFIG_FILE "SDL_GAMECONTROLLERCONFIG_FILE"
|
||||
|
||||
@ -484,7 +484,7 @@ extern "C" {
|
||||
* PS5
|
||||
* SwitchPro
|
||||
*
|
||||
* This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
|
||||
* This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMEPAD)
|
||||
*/
|
||||
#define SDL_HINT_GAMECONTROLLERTYPE "SDL_GAMECONTROLLERTYPE"
|
||||
|
||||
@ -676,7 +676,7 @@ extern "C" {
|
||||
* "0" - Left and right Joy-Con controllers will not be in vertical mode (the default)
|
||||
* "1" - Left and right Joy-Con controllers will be in vertical mode
|
||||
*
|
||||
* This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
|
||||
* This hint must be set before calling SDL_Init(SDL_INIT_GAMEPAD)
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS"
|
||||
|
||||
|
@ -50,13 +50,13 @@ extern "C" {
|
||||
#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_GAMEPAD 0x00002000u /**< SDL_INIT_GAMEPAD 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_SENSOR \
|
||||
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMEPAD | SDL_INIT_SENSOR \
|
||||
)
|
||||
/* @} */
|
||||
|
||||
@ -85,7 +85,7 @@ extern "C" {
|
||||
* - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the
|
||||
* events subsystem
|
||||
* - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem
|
||||
* - `SDL_INIT_GAMECONTROLLER`: controller subsystem; automatically
|
||||
* - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically
|
||||
* initializes the joystick subsystem
|
||||
* - `SDL_INIT_EVENTS`: events subsystem
|
||||
* - `SDL_INIT_EVERYTHING`: all of the above subsystems
|
||||
|
@ -375,9 +375,9 @@ typedef struct SDL_VirtualJoystickDesc
|
||||
Uint16 product_id; /**< the USB product ID of this joystick */
|
||||
Uint16 padding; /**< unused */
|
||||
Uint32 button_mask; /**< A mask of which buttons are valid for this controller
|
||||
e.g. (1 << SDL_CONTROLLER_BUTTON_A) */
|
||||
e.g. (1 << SDL_GAMEPAD_BUTTON_A) */
|
||||
Uint32 axis_mask; /**< A mask of which axes are valid for this controller
|
||||
e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) */
|
||||
e.g. (1 << SDL_GAMEPAD_AXIS_LEFTX) */
|
||||
const char *name; /**< the name of the joystick */
|
||||
|
||||
void *userdata; /**< User data pointer passed to callbacks */
|
||||
@ -782,7 +782,7 @@ extern DECLSPEC void SDLCALL SDL_UpdateJoysticks(void);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GameControllerEventState
|
||||
* \sa SDL_GetGamepadEventState
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetJoystickEventState(int state);
|
||||
|
||||
|
@ -49,6 +49,138 @@
|
||||
#define SDL_FreeWAV SDL_free
|
||||
#define SDL_NewAudioStream SDL_CreateAudioStream
|
||||
|
||||
/* ##SDL_events.h */
|
||||
#define SDL_CONTROLLERAXISMOTION SDL_GAMEPADAXISMOTION
|
||||
#define SDL_CONTROLLERBUTTONDOWN SDL_GAMEPADBUTTONDOWN
|
||||
#define SDL_CONTROLLERBUTTONUP SDL_GAMEPADBUTTONUP
|
||||
#define SDL_CONTROLLERDEVICEADDED SDL_GAMEPADADDED
|
||||
#define SDL_CONTROLLERDEVICEREMAPPED SDL_GAMEPADDEVICEREMAPPED
|
||||
#define SDL_CONTROLLERDEVICEREMOVED SDL_GAMEPADREMOVED
|
||||
#define SDL_CONTROLLERSENSORUPDATE SDL_GAMEPADSENSORUPDATE
|
||||
#define SDL_CONTROLLERTOUCHPADDOWN SDL_GAMEPADTOUCHPADDOWN
|
||||
#define SDL_CONTROLLERTOUCHPADMOTION SDL_GAMEPADTOUCHPADMOTION
|
||||
#define SDL_CONTROLLERTOUCHPADUP SDL_GAMEPADTOUCHPADUP
|
||||
#define SDL_ControllerAxisEvent SDL_GamepadAxisEvent
|
||||
#define SDL_ControllerButtonEvent SDL_GamepadButtonEvent
|
||||
#define SDL_ControllerDeviceEvent SDL_GamepadDeviceEvent
|
||||
#define SDL_ControllerSensorEvent SDL_GamepadSensorEvent
|
||||
#define SDL_ControllerTouchpadEvent SDL_GamepadTouchpadEvent
|
||||
|
||||
/* ##SDL_gamepad.h */
|
||||
#define SDL_CONTROLLER_AXIS_INVALID SDL_GAMEPAD_AXIS_INVALID
|
||||
#define SDL_CONTROLLER_AXIS_LEFTX SDL_GAMEPAD_AXIS_LEFTX
|
||||
#define SDL_CONTROLLER_AXIS_LEFTY SDL_GAMEPAD_AXIS_LEFTY
|
||||
#define SDL_CONTROLLER_AXIS_MAX SDL_GAMEPAD_AXIS_MAX
|
||||
#define SDL_CONTROLLER_AXIS_RIGHTX SDL_GAMEPAD_AXIS_RIGHTX
|
||||
#define SDL_CONTROLLER_AXIS_RIGHTY SDL_GAMEPAD_AXIS_RIGHTY
|
||||
#define SDL_CONTROLLER_AXIS_TRIGGERLEFT SDL_GAMEPAD_AXIS_LEFT_TRIGGER
|
||||
#define SDL_CONTROLLER_AXIS_TRIGGERRIGHT SDL_GAMEPAD_AXIS_RIGHT_TRIGGER
|
||||
#define SDL_CONTROLLER_BINDTYPE_AXIS SDL_GAMEPAD_BINDTYPE_AXIS
|
||||
#define SDL_CONTROLLER_BINDTYPE_BUTTON SDL_GAMEPAD_BINDTYPE_BUTTON
|
||||
#define SDL_CONTROLLER_BINDTYPE_HAT SDL_GAMEPAD_BINDTYPE_HAT
|
||||
#define SDL_CONTROLLER_BINDTYPE_NONE SDL_GAMEPAD_BINDTYPE_NONE
|
||||
#define SDL_CONTROLLER_BUTTON_A SDL_GAMEPAD_BUTTON_A
|
||||
#define SDL_CONTROLLER_BUTTON_B SDL_GAMEPAD_BUTTON_B
|
||||
#define SDL_CONTROLLER_BUTTON_BACK SDL_GAMEPAD_BUTTON_BACK
|
||||
#define SDL_CONTROLLER_BUTTON_DPAD_DOWN SDL_GAMEPAD_BUTTON_DPAD_DOWN
|
||||
#define SDL_CONTROLLER_BUTTON_DPAD_LEFT SDL_GAMEPAD_BUTTON_DPAD_LEFT
|
||||
#define SDL_CONTROLLER_BUTTON_DPAD_RIGHT SDL_GAMEPAD_BUTTON_DPAD_RIGHT
|
||||
#define SDL_CONTROLLER_BUTTON_DPAD_UP SDL_GAMEPAD_BUTTON_DPAD_UP
|
||||
#define SDL_CONTROLLER_BUTTON_GUIDE SDL_GAMEPAD_BUTTON_GUIDE
|
||||
#define SDL_CONTROLLER_BUTTON_INVALID SDL_GAMEPAD_BUTTON_INVALID
|
||||
#define SDL_CONTROLLER_BUTTON_LEFTSHOULDER SDL_GAMEPAD_BUTTON_LEFT_SHOULDER
|
||||
#define SDL_CONTROLLER_BUTTON_LEFTSTICK SDL_GAMEPAD_BUTTON_LEFT_STICK
|
||||
#define SDL_CONTROLLER_BUTTON_MAX SDL_GAMEPAD_BUTTON_MAX
|
||||
#define SDL_CONTROLLER_BUTTON_MISC1 SDL_GAMEPAD_BUTTON_MISC1
|
||||
#define SDL_CONTROLLER_BUTTON_PADDLE1 SDL_GAMEPAD_BUTTON_PADDLE1
|
||||
#define SDL_CONTROLLER_BUTTON_PADDLE2 SDL_GAMEPAD_BUTTON_PADDLE2
|
||||
#define SDL_CONTROLLER_BUTTON_PADDLE3 SDL_GAMEPAD_BUTTON_PADDLE3
|
||||
#define SDL_CONTROLLER_BUTTON_PADDLE4 SDL_GAMEPAD_BUTTON_PADDLE4
|
||||
#define SDL_CONTROLLER_BUTTON_RIGHTSHOULDER SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER
|
||||
#define SDL_CONTROLLER_BUTTON_RIGHTSTICK SDL_GAMEPAD_BUTTON_RIGHT_STICK
|
||||
#define SDL_CONTROLLER_BUTTON_START SDL_GAMEPAD_BUTTON_START
|
||||
#define SDL_CONTROLLER_BUTTON_TOUCHPAD SDL_GAMEPAD_BUTTON_TOUCHPAD
|
||||
#define SDL_CONTROLLER_BUTTON_X SDL_GAMEPAD_BUTTON_X
|
||||
#define SDL_CONTROLLER_BUTTON_Y SDL_GAMEPAD_BUTTON_Y
|
||||
#define SDL_CONTROLLER_TYPE_AMAZON_LUNA SDL_GAMEPAD_TYPE_AMAZON_LUNA
|
||||
#define SDL_CONTROLLER_TYPE_GOOGLE_STADIA SDL_GAMEPAD_TYPE_GOOGLE_STADIA
|
||||
#define SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT
|
||||
#define SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
|
||||
#define SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT
|
||||
#define SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO
|
||||
#define SDL_CONTROLLER_TYPE_NVIDIA_SHIELD SDL_GAMEPAD_TYPE_NVIDIA_SHIELD
|
||||
#define SDL_CONTROLLER_TYPE_PS3 SDL_GAMEPAD_TYPE_PS3
|
||||
#define SDL_CONTROLLER_TYPE_PS4 SDL_GAMEPAD_TYPE_PS4
|
||||
#define SDL_CONTROLLER_TYPE_PS5 SDL_GAMEPAD_TYPE_PS5
|
||||
#define SDL_CONTROLLER_TYPE_UNKNOWN SDL_GAMEPAD_TYPE_UNKNOWN
|
||||
#define SDL_CONTROLLER_TYPE_VIRTUAL SDL_GAMEPAD_TYPE_VIRTUAL
|
||||
#define SDL_CONTROLLER_TYPE_XBOX360 SDL_GAMEPAD_TYPE_XBOX360
|
||||
#define SDL_CONTROLLER_TYPE_XBOXONE SDL_GAMEPAD_TYPE_XBOXONE
|
||||
#define SDL_GameController SDL_Gamepad
|
||||
#define SDL_GameControllerAddMapping SDL_AddGamepadMapping
|
||||
#define SDL_GameControllerAddMappingsFromFile SDL_AddGamepadMappingsFromFile
|
||||
#define SDL_GameControllerAddMappingsFromRW SDL_AddGamepadMappingsFromRW
|
||||
#define SDL_GameControllerAxis SDL_GamepadAxis
|
||||
#define SDL_GameControllerBindType SDL_GamepadBindingType
|
||||
#define SDL_GameControllerButton SDL_GamepadButton
|
||||
#define SDL_GameControllerButtonBind SDL_GamepadBinding
|
||||
#define SDL_GameControllerClose SDL_CloseGamepad
|
||||
#define SDL_GameControllerEventState SDL_GetGamepadEventState
|
||||
#define SDL_GameControllerFromInstanceID SDL_GetGamepadFromInstanceID
|
||||
#define SDL_GameControllerFromPlayerIndex SDL_GetGamepadFromPlayerIndex
|
||||
#define SDL_GameControllerGetAppleSFSymbolsNameForAxis SDL_GetGamepadAppleSFSymbolsNameForAxis
|
||||
#define SDL_GameControllerGetAppleSFSymbolsNameForButton SDL_GetGamepadAppleSFSymbolsNameForButton
|
||||
#define SDL_GameControllerGetAttached SDL_IsGamepadConnected
|
||||
#define SDL_GameControllerGetAxis SDL_GetGamepadAxis
|
||||
#define SDL_GameControllerGetAxisFromString SDL_GetGamepadAxisFromString
|
||||
#define SDL_GameControllerGetBindForAxis SDL_GetGamepadBindForAxis
|
||||
#define SDL_GameControllerGetBindForButton SDL_GetGamepadBindForButton
|
||||
#define SDL_GameControllerGetButton SDL_GetGamepadButton
|
||||
#define SDL_GameControllerGetButtonFromString SDL_GetGamepadButtonFromString
|
||||
#define SDL_GameControllerGetFirmwareVersion SDL_GetGamepadFirmwareVersion
|
||||
#define SDL_GameControllerGetJoystick SDL_GetGamepadJoystick
|
||||
#define SDL_GameControllerGetNumTouchpadFingers SDL_GetGamepadNumTouchpadFingers
|
||||
#define SDL_GameControllerGetNumTouchpads SDL_GetGamepadNumTouchpads
|
||||
#define SDL_GameControllerGetPlayerIndex SDL_GetGamepadPlayerIndex
|
||||
#define SDL_GameControllerGetProduct SDL_GetGamepadProduct
|
||||
#define SDL_GameControllerGetProductVersion SDL_GetGamepadProductVersion
|
||||
#define SDL_GameControllerGetSensorData SDL_GetGamepadSensorData
|
||||
#define SDL_GameControllerGetSensorDataRate SDL_GetGamepadSensorDataRate
|
||||
#define SDL_GameControllerGetSerial SDL_GetGamepadSerial
|
||||
#define SDL_GameControllerGetStringForAxis SDL_GetGamepadStringForAxis
|
||||
#define SDL_GameControllerGetStringForButton SDL_GetGamepadStringForButton
|
||||
#define SDL_GameControllerGetTouchpadFinger SDL_GetGamepadTouchpadFinger
|
||||
#define SDL_GameControllerGetType SDL_GetGamepadType
|
||||
#define SDL_GameControllerGetVendor SDL_GetGamepadVendor
|
||||
#define SDL_GameControllerHasAxis SDL_GamepadHasAxis
|
||||
#define SDL_GameControllerHasButton SDL_GamepadHasButton
|
||||
#define SDL_GameControllerHasLED SDL_GamepadHasLED
|
||||
#define SDL_GameControllerHasRumble SDL_GamepadHasRumble
|
||||
#define SDL_GameControllerHasRumbleTriggers SDL_GamepadHasRumbleTriggers
|
||||
#define SDL_GameControllerHasSensor SDL_GamepadHasSensor
|
||||
#define SDL_GameControllerIsSensorEnabled SDL_IsGamepadSensorEnabled
|
||||
#define SDL_GameControllerMapping SDL_GetGamepadMapping
|
||||
#define SDL_GameControllerMappingForDeviceIndex SDL_GetGamepadMappingForDeviceIndex
|
||||
#define SDL_GameControllerMappingForGUID SDL_GetGamepadMappingForGUID
|
||||
#define SDL_GameControllerMappingForIndex SDL_GetGamepadMappingForIndex
|
||||
#define SDL_GameControllerName SDL_GetGamepadName
|
||||
#define SDL_GameControllerNameForIndex SDL_GetGamepadNameForIndex
|
||||
#define SDL_GameControllerNumMappings SDL_GetNumGamepadMappings
|
||||
#define SDL_GameControllerOpen SDL_OpenGamepad
|
||||
#define SDL_GameControllerPath SDL_GetGamepadPath
|
||||
#define SDL_GameControllerPathForIndex SDL_GetGamepadPathForIndex
|
||||
#define SDL_GameControllerRumble SDL_RumbleGamepad
|
||||
#define SDL_GameControllerRumbleTriggers SDL_RumbleGamepadTriggers
|
||||
#define SDL_GameControllerSendEffect SDL_SendGamepadEffect
|
||||
#define SDL_GameControllerSetLED SDL_SetGamepadLED
|
||||
#define SDL_GameControllerSetPlayerIndex SDL_SetGamepadPlayerIndex
|
||||
#define SDL_GameControllerSetSensorEnabled SDL_SetGamepadSensorEnabled
|
||||
#define SDL_GameControllerType SDL_GamepadType
|
||||
#define SDL_GameControllerTypeForIndex SDL_GetGamepadTypeForIndex
|
||||
#define SDL_GameControllerUpdate SDL_UpdateGamepads
|
||||
#define SDL_INIT_GAMECONTROLLER SDL_INIT_GAMEPAD
|
||||
#define SDL_IsGameController SDL_IsGamepad
|
||||
|
||||
/* ##SDL_joystick.h */
|
||||
#define SDL_JoystickAttachVirtual SDL_AttachVirtualJoystick
|
||||
#define SDL_JoystickAttachVirtualEx SDL_AttachVirtualJoystickEx
|
||||
@ -223,6 +355,138 @@
|
||||
#define SDL_FreeWAV SDL_FreeWAV_renamed_SDL_free
|
||||
#define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream
|
||||
|
||||
/* ##SDL_events.h */
|
||||
#define SDL_CONTROLLERAXISMOTION SDL_CONTROLLERAXISMOTION_renamed_SDL_GAMEPADAXISMOTION
|
||||
#define SDL_CONTROLLERBUTTONDOWN SDL_CONTROLLERBUTTONDOWN_renamed_SDL_GAMEPADBUTTONDOWN
|
||||
#define SDL_CONTROLLERBUTTONUP SDL_CONTROLLERBUTTONUP_renamed_SDL_GAMEPADBUTTONUP
|
||||
#define SDL_CONTROLLERDEVICEADDED SDL_CONTROLLERDEVICEADDED_renamed_SDL_GAMEPADDEVICEADDED
|
||||
#define SDL_CONTROLLERDEVICEREMAPPED SDL_CONTROLLERDEVICEREMAPPED_renamed_SDL_GAMEPADDEVICEREMAPPED
|
||||
#define SDL_CONTROLLERDEVICEREMOVED SDL_CONTROLLERDEVICEREMOVED_renamed_SDL_GAMEPADDEVICEREMOVED
|
||||
#define SDL_CONTROLLERSENSORUPDATE SDL_CONTROLLERSENSORUPDATE_renamed_SDL_GAMEPADSENSORUPDATE
|
||||
#define SDL_CONTROLLERTOUCHPADDOWN SDL_CONTROLLERTOUCHPADDOWN_renamed_SDL_GAMEPADTOUCHPADDOWN
|
||||
#define SDL_CONTROLLERTOUCHPADMOTION SDL_CONTROLLERTOUCHPADMOTION_renamed_SDL_GAMEPADTOUCHPADMOTION
|
||||
#define SDL_CONTROLLERTOUCHPADUP SDL_CONTROLLERTOUCHPADUP_renamed_SDL_GAMEPADTOUCHPADUP
|
||||
#define SDL_ControllerAxisEvent SDL_ControllerAxisEvent_renamed_SDL_GamepadAxisEvent
|
||||
#define SDL_ControllerButtonEvent SDL_ControllerButtonEvent_renamed_SDL_GamepadButtonEvent
|
||||
#define SDL_ControllerDeviceEvent SDL_ControllerDeviceEvent_renamed_SDL_GamepadDeviceEvent
|
||||
#define SDL_ControllerSensorEvent SDL_ControllerSensorEvent_renamed_SDL_GamepadSensorEvent
|
||||
#define SDL_ControllerTouchpadEvent SDL_ControllerTouchpadEvent_renamed_SDL_GamepadTouchpadEvent
|
||||
|
||||
/* ##SDL_gamepad.h */
|
||||
#define SDL_CONTROLLER_AXIS_INVALID SDL_CONTROLLER_AXIS_INVALID_renamed_SDL_GAMEPAD_AXIS_INVALID
|
||||
#define SDL_CONTROLLER_AXIS_LEFTX SDL_CONTROLLER_AXIS_LEFTX_renamed_SDL_GAMEPAD_AXIS_LEFTX
|
||||
#define SDL_CONTROLLER_AXIS_LEFTY SDL_CONTROLLER_AXIS_LEFTY_renamed_SDL_GAMEPAD_AXIS_LEFTY
|
||||
#define SDL_CONTROLLER_AXIS_MAX SDL_CONTROLLER_AXIS_MAX_renamed_SDL_GAMEPAD_AXIS_MAX
|
||||
#define SDL_CONTROLLER_AXIS_RIGHTX SDL_CONTROLLER_AXIS_RIGHTX_renamed_SDL_GAMEPAD_AXIS_RIGHTX
|
||||
#define SDL_CONTROLLER_AXIS_RIGHTY SDL_CONTROLLER_AXIS_RIGHTY_renamed_SDL_GAMEPAD_AXIS_RIGHTY
|
||||
#define SDL_CONTROLLER_AXIS_TRIGGERLEFT SDL_CONTROLLER_AXIS_TRIGGERLEFT_renamed_SDL_GAMEPAD_AXIS_LEFT_TRIGGER
|
||||
#define SDL_CONTROLLER_AXIS_TRIGGERRIGHT SDL_CONTROLLER_AXIS_TRIGGERRIGHT_renamed_SDL_GAMEPAD_AXIS_RIGHT_TRIGGER
|
||||
#define SDL_CONTROLLER_BINDTYPE_AXIS SDL_CONTROLLER_BINDTYPE_AXIS_renamed_SDL_GAMEPAD_BINDTYPE_AXIS
|
||||
#define SDL_CONTROLLER_BINDTYPE_BUTTON SDL_CONTROLLER_BINDTYPE_BUTTON_renamed_SDL_GAMEPAD_BINDTYPE_BUTTON
|
||||
#define SDL_CONTROLLER_BINDTYPE_HAT SDL_CONTROLLER_BINDTYPE_HAT_renamed_SDL_GAMEPAD_BINDTYPE_HAT
|
||||
#define SDL_CONTROLLER_BINDTYPE_NONE SDL_CONTROLLER_BINDTYPE_NONE_renamed_SDL_GAMEPAD_BINDTYPE_NONE
|
||||
#define SDL_CONTROLLER_BUTTON_A SDL_CONTROLLER_BUTTON_A_renamed_SDL_GAMEPAD_BUTTON_A
|
||||
#define SDL_CONTROLLER_BUTTON_B SDL_CONTROLLER_BUTTON_B_renamed_SDL_GAMEPAD_BUTTON_B
|
||||
#define SDL_CONTROLLER_BUTTON_BACK SDL_CONTROLLER_BUTTON_BACK_renamed_SDL_GAMEPAD_BUTTON_BACK
|
||||
#define SDL_CONTROLLER_BUTTON_DPAD_DOWN SDL_CONTROLLER_BUTTON_DPAD_DOWN_renamed_SDL_GAMEPAD_BUTTON_DPAD_DOWN
|
||||
#define SDL_CONTROLLER_BUTTON_DPAD_LEFT SDL_CONTROLLER_BUTTON_DPAD_LEFT_renamed_SDL_GAMEPAD_BUTTON_DPAD_LEFT
|
||||
#define SDL_CONTROLLER_BUTTON_DPAD_RIGHT SDL_CONTROLLER_BUTTON_DPAD_RIGHT_renamed_SDL_GAMEPAD_BUTTON_DPAD_RIGHT
|
||||
#define SDL_CONTROLLER_BUTTON_DPAD_UP SDL_CONTROLLER_BUTTON_DPAD_UP_renamed_SDL_GAMEPAD_BUTTON_DPAD_UP
|
||||
#define SDL_CONTROLLER_BUTTON_GUIDE SDL_CONTROLLER_BUTTON_GUIDE_renamed_SDL_GAMEPAD_BUTTON_GUIDE
|
||||
#define SDL_CONTROLLER_BUTTON_INVALID SDL_CONTROLLER_BUTTON_INVALID_renamed_SDL_GAMEPAD_BUTTON_INVALID
|
||||
#define SDL_CONTROLLER_BUTTON_LEFTSHOULDER SDL_CONTROLLER_BUTTON_LEFTSHOULDER_renamed_SDL_GAMEPAD_BUTTON_LEFT_SHOULDER
|
||||
#define SDL_CONTROLLER_BUTTON_LEFTSTICK SDL_CONTROLLER_BUTTON_LEFTSTICK_renamed_SDL_GAMEPAD_BUTTON_LEFT_STICK
|
||||
#define SDL_CONTROLLER_BUTTON_MAX SDL_CONTROLLER_BUTTON_MAX_renamed_SDL_GAMEPAD_BUTTON_MAX
|
||||
#define SDL_CONTROLLER_BUTTON_MISC1 SDL_CONTROLLER_BUTTON_MISC1_renamed_SDL_GAMEPAD_BUTTON_MISC1
|
||||
#define SDL_CONTROLLER_BUTTON_PADDLE1 SDL_CONTROLLER_BUTTON_PADDLE1_renamed_SDL_GAMEPAD_BUTTON_PADDLE1
|
||||
#define SDL_CONTROLLER_BUTTON_PADDLE2 SDL_CONTROLLER_BUTTON_PADDLE2_renamed_SDL_GAMEPAD_BUTTON_PADDLE2
|
||||
#define SDL_CONTROLLER_BUTTON_PADDLE3 SDL_CONTROLLER_BUTTON_PADDLE3_renamed_SDL_GAMEPAD_BUTTON_PADDLE3
|
||||
#define SDL_CONTROLLER_BUTTON_PADDLE4 SDL_CONTROLLER_BUTTON_PADDLE4_renamed_SDL_GAMEPAD_BUTTON_PADDLE4
|
||||
#define SDL_CONTROLLER_BUTTON_RIGHTSHOULDER SDL_CONTROLLER_BUTTON_RIGHTSHOULDER_renamed_SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER
|
||||
#define SDL_CONTROLLER_BUTTON_RIGHTSTICK SDL_CONTROLLER_BUTTON_RIGHTSTICK_renamed_SDL_GAMEPAD_BUTTON_RIGHT_STICK
|
||||
#define SDL_CONTROLLER_BUTTON_START SDL_CONTROLLER_BUTTON_START_renamed_SDL_GAMEPAD_BUTTON_START
|
||||
#define SDL_CONTROLLER_BUTTON_TOUCHPAD SDL_CONTROLLER_BUTTON_TOUCHPAD_renamed_SDL_GAMEPAD_BUTTON_TOUCHPAD
|
||||
#define SDL_CONTROLLER_BUTTON_X SDL_CONTROLLER_BUTTON_X_renamed_SDL_GAMEPAD_BUTTON_X
|
||||
#define SDL_CONTROLLER_BUTTON_Y SDL_CONTROLLER_BUTTON_Y_renamed_SDL_GAMEPAD_BUTTON_Y
|
||||
#define SDL_CONTROLLER_TYPE_AMAZON_LUNA SDL_CONTROLLER_TYPE_AMAZON_LUNA_renamed_SDL_GAMEPAD_TYPE_AMAZON_LUNA
|
||||
#define SDL_CONTROLLER_TYPE_GOOGLE_STADIA SDL_CONTROLLER_TYPE_GOOGLE_STADIA_renamed_SDL_GAMEPAD_TYPE_GOOGLE_STADIA
|
||||
#define SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT_renamed_SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT
|
||||
#define SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR_renamed_SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
|
||||
#define SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT_renamed_SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT
|
||||
#define SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO_renamed_SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO
|
||||
#define SDL_CONTROLLER_TYPE_NVIDIA_SHIELD SDL_CONTROLLER_TYPE_NVIDIA_SHIELD_renamed_SDL_GAMEPAD_TYPE_NVIDIA_SHIELD
|
||||
#define SDL_CONTROLLER_TYPE_PS3 SDL_CONTROLLER_TYPE_PS3_renamed_SDL_GAMEPAD_TYPE_PS3
|
||||
#define SDL_CONTROLLER_TYPE_PS4 SDL_CONTROLLER_TYPE_PS4_renamed_SDL_GAMEPAD_TYPE_PS4
|
||||
#define SDL_CONTROLLER_TYPE_PS5 SDL_CONTROLLER_TYPE_PS5_renamed_SDL_GAMEPAD_TYPE_PS5
|
||||
#define SDL_CONTROLLER_TYPE_UNKNOWN SDL_CONTROLLER_TYPE_UNKNOWN_renamed_SDL_GAMEPAD_TYPE_UNKNOWN
|
||||
#define SDL_CONTROLLER_TYPE_VIRTUAL SDL_CONTROLLER_TYPE_VIRTUAL_renamed_SDL_GAMEPAD_TYPE_VIRTUAL
|
||||
#define SDL_CONTROLLER_TYPE_XBOX360 SDL_CONTROLLER_TYPE_XBOX360_renamed_SDL_GAMEPAD_TYPE_XBOX360
|
||||
#define SDL_CONTROLLER_TYPE_XBOXONE SDL_CONTROLLER_TYPE_XBOXONE_renamed_SDL_GAMEPAD_TYPE_XBOXONE
|
||||
#define SDL_GameController SDL_GameController_renamed_SDL_Gamepad
|
||||
#define SDL_GameControllerAddMapping SDL_GameControllerAddMapping_renamed_SDL_AddGamepadMapping
|
||||
#define SDL_GameControllerAddMappingsFromFile SDL_GameControllerAddMappingsFromFile_renamed_SDL_AddGamepadMappingsFromFile
|
||||
#define SDL_GameControllerAddMappingsFromRW SDL_GameControllerAddMappingsFromRW_renamed_SDL_AddGamepadMappingsFromRW
|
||||
#define SDL_GameControllerAxis SDL_GameControllerAxis_renamed_SDL_GamepadAxis
|
||||
#define SDL_GameControllerBindType SDL_GameControllerBindType_renamed_SDL_GamepadBindingType
|
||||
#define SDL_GameControllerButton SDL_GameControllerButton_renamed_SDL_GamepadButton
|
||||
#define SDL_GameControllerButtonBind SDL_GameControllerButtonBind_renamed_SDL_GamepadBinding
|
||||
#define SDL_GameControllerClose SDL_GameControllerClose_renamed_SDL_CloseGamepad
|
||||
#define SDL_GameControllerEventState SDL_GameControllerEventState_renamed_SDL_GetGamepadEventState
|
||||
#define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_renamed_SDL_GetGamepadFromInstanceID
|
||||
#define SDL_GameControllerFromPlayerIndex SDL_GameControllerFromPlayerIndex_renamed_SDL_GetGamepadFromPlayerIndex
|
||||
#define SDL_GameControllerGetAppleSFSymbolsNameForAxis SDL_GameControllerGetAppleSFSymbolsNameForAxis_renamed_SDL_GetGamepadAppleSFSymbolsNameForAxis
|
||||
#define SDL_GameControllerGetAppleSFSymbolsNameForButton SDL_GameControllerGetAppleSFSymbolsNameForButton_renamed_SDL_GetGamepadAppleSFSymbolsNameForButton
|
||||
#define SDL_GameControllerGetAttached SDL_GameControllerGetAttached_renamed_SDL_IsGamepadConnected
|
||||
#define SDL_GameControllerGetAxis SDL_GameControllerGetAxis_renamed_SDL_GetGamepadAxis
|
||||
#define SDL_GameControllerGetAxisFromString SDL_GameControllerGetAxisFromString_renamed_SDL_GetGamepadAxisFromString
|
||||
#define SDL_GameControllerGetBindForAxis SDL_GameControllerGetBindForAxis_renamed_SDL_GetGamepadBindForAxis
|
||||
#define SDL_GameControllerGetBindForButton SDL_GameControllerGetBindForButton_renamed_SDL_GetGamepadBindForButton
|
||||
#define SDL_GameControllerGetButton SDL_GameControllerGetButton_renamed_SDL_GetGamepadButton
|
||||
#define SDL_GameControllerGetButtonFromString SDL_GameControllerGetButtonFromString_renamed_SDL_GetGamepadButtonFromString
|
||||
#define SDL_GameControllerGetFirmwareVersion SDL_GameControllerGetFirmwareVersion_renamed_SDL_GetGamepadFirmwareVersion
|
||||
#define SDL_GameControllerGetJoystick SDL_GameControllerGetJoystick_renamed_SDL_GetGamepadJoystick
|
||||
#define SDL_GameControllerGetNumTouchpadFingers SDL_GameControllerGetNumTouchpadFingers_renamed_SDL_GetGamepadNumTouchpadFingers
|
||||
#define SDL_GameControllerGetNumTouchpads SDL_GameControllerGetNumTouchpads_renamed_SDL_GetGamepadNumTouchpads
|
||||
#define SDL_GameControllerGetPlayerIndex SDL_GameControllerGetPlayerIndex_renamed_SDL_GetGamepadPlayerIndex
|
||||
#define SDL_GameControllerGetProduct SDL_GameControllerGetProduct_renamed_SDL_GetGamepadProduct
|
||||
#define SDL_GameControllerGetProductVersion SDL_GameControllerGetProductVersion_renamed_SDL_GetGamepadProductVersion
|
||||
#define SDL_GameControllerGetSensorData SDL_GameControllerGetSensorData_renamed_SDL_GetGamepadSensorData
|
||||
#define SDL_GameControllerGetSensorDataRate SDL_GameControllerGetSensorDataRate_renamed_SDL_GetGamepadSensorDataRate
|
||||
#define SDL_GameControllerGetSerial SDL_GameControllerGetSerial_renamed_SDL_GetGamepadSerial
|
||||
#define SDL_GameControllerGetStringForAxis SDL_GameControllerGetStringForAxis_renamed_SDL_GetGamepadStringForAxis
|
||||
#define SDL_GameControllerGetStringForButton SDL_GameControllerGetStringForButton_renamed_SDL_GetGamepadStringForButton
|
||||
#define SDL_GameControllerGetTouchpadFinger SDL_GameControllerGetTouchpadFinger_renamed_SDL_GetGamepadTouchpadFinger
|
||||
#define SDL_GameControllerGetType SDL_GameControllerGetType_renamed_SDL_GetGamepadType
|
||||
#define SDL_GameControllerGetVendor SDL_GameControllerGetVendor_renamed_SDL_GetGamepadVendor
|
||||
#define SDL_GameControllerHasAxis SDL_GameControllerHasAxis_renamed_SDL_GamepadHasAxis
|
||||
#define SDL_GameControllerHasButton SDL_GameControllerHasButton_renamed_SDL_GamepadHasButton
|
||||
#define SDL_GameControllerHasLED SDL_GameControllerHasLED_renamed_SDL_GamepadHasLED
|
||||
#define SDL_GameControllerHasRumble SDL_GameControllerHasRumble_renamed_SDL_GamepadHasRumble
|
||||
#define SDL_GameControllerHasRumbleTriggers SDL_GameControllerHasRumbleTriggers_renamed_SDL_GamepadHasRumbleTriggers
|
||||
#define SDL_GameControllerHasSensor SDL_GameControllerHasSensor_renamed_SDL_GamepadHasSensor
|
||||
#define SDL_GameControllerIsSensorEnabled SDL_GameControllerIsSensorEnabled_renamed_SDL_IsGamepadSensorEnabled
|
||||
#define SDL_GameControllerMapping SDL_GameControllerMapping_renamed_SDL_GetGamepadMapping
|
||||
#define SDL_GameControllerMappingForDeviceIndex SDL_GameControllerMappingForDeviceIndex_renamed_SDL_GetGamepadMappingForDeviceIndex
|
||||
#define SDL_GameControllerMappingForGUID SDL_GameControllerMappingForGUID_renamed_SDL_GetGamepadMappingForGUID
|
||||
#define SDL_GameControllerMappingForIndex SDL_GameControllerMappingForIndex_renamed_SDL_GetGamepadMappingForIndex
|
||||
#define SDL_GameControllerName SDL_GameControllerName_renamed_SDL_GetGamepadName
|
||||
#define SDL_GameControllerNameForIndex SDL_GameControllerNameForIndex_renamed_SDL_GetGamepadNameForIndex
|
||||
#define SDL_GameControllerNumMappings SDL_GameControllerNumMappings_renamed_SDL_GetNumGamepadMappings
|
||||
#define SDL_GameControllerOpen SDL_GameControllerOpen_renamed_SDL_OpenGamepad
|
||||
#define SDL_GameControllerPath SDL_GameControllerPath_renamed_SDL_GetGamepadPath
|
||||
#define SDL_GameControllerPathForIndex SDL_GameControllerPathForIndex_renamed_SDL_GetGamepadPathForIndex
|
||||
#define SDL_GameControllerRumble SDL_GameControllerRumble_renamed_SDL_RumbleGamepad
|
||||
#define SDL_GameControllerRumbleTriggers SDL_GameControllerRumbleTriggers_renamed_SDL_RumbleGamepadTriggers
|
||||
#define SDL_GameControllerSendEffect SDL_GameControllerSendEffect_renamed_SDL_SendGamepadEffect
|
||||
#define SDL_GameControllerSetLED SDL_GameControllerSetLED_renamed_SDL_SetGamepadLED
|
||||
#define SDL_GameControllerSetPlayerIndex SDL_GameControllerSetPlayerIndex_renamed_SDL_SetGamepadPlayerIndex
|
||||
#define SDL_GameControllerSetSensorEnabled SDL_GameControllerSetSensorEnabled_renamed_SDL_SetGamepadSensorEnabled
|
||||
#define SDL_GameControllerType SDL_GameControllerType_renamed_SDL_GamepadType
|
||||
#define SDL_GameControllerTypeForIndex SDL_GameControllerTypeForIndex_renamed_SDL_GetGamepadTypeForIndex
|
||||
#define SDL_GameControllerUpdate SDL_GameControllerUpdate_renamed_SDL_UpdateGamepads
|
||||
#define SDL_INIT_GAMECONTROLLER SDL_INIT_GAMECONTROLLER_renamed_SDL_INIT_GAMEPAD
|
||||
#define SDL_IsGameController SDL_IsGameController_renamed_SDL_IsGamepad
|
||||
|
||||
/* ##SDL_joystick.h */
|
||||
#define SDL_JoystickAttachVirtual SDL_JoystickAttachVirtual_renamed_SDL_AttachVirtualJoystick
|
||||
#define SDL_JoystickAttachVirtualEx SDL_JoystickAttachVirtualEx_renamed_SDL_AttachVirtualJoystickEx
|
||||
|
20
src/SDL.c
20
src/SDL.c
@ -173,7 +173,7 @@ int SDL_InitSubSystem(Uint32 flags)
|
||||
SDL_DBus_Init();
|
||||
#endif
|
||||
|
||||
if ((flags & SDL_INIT_GAMECONTROLLER)) {
|
||||
if ((flags & SDL_INIT_GAMEPAD)) {
|
||||
/* game controller implies joystick */
|
||||
flags |= SDL_INIT_JOYSTICK;
|
||||
}
|
||||
@ -275,15 +275,15 @@ int SDL_InitSubSystem(Uint32 flags)
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((flags & SDL_INIT_GAMECONTROLLER)) {
|
||||
if ((flags & SDL_INIT_GAMEPAD)) {
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) {
|
||||
if (SDL_GameControllerInit() < 0) {
|
||||
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMEPAD)) {
|
||||
if (SDL_GamepadInit() < 0) {
|
||||
goto quit_and_error;
|
||||
}
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountIncr(SDL_INIT_GAMECONTROLLER);
|
||||
flags_initialized |= SDL_INIT_GAMECONTROLLER;
|
||||
SDL_PrivateSubsystemRefCountIncr(SDL_INIT_GAMEPAD);
|
||||
flags_initialized |= SDL_INIT_GAMEPAD;
|
||||
#else
|
||||
SDL_SetError("SDL not built with joystick support");
|
||||
goto quit_and_error;
|
||||
@ -349,14 +349,14 @@ void SDL_QuitSubSystem(Uint32 flags)
|
||||
#endif
|
||||
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
if ((flags & SDL_INIT_GAMECONTROLLER)) {
|
||||
if ((flags & SDL_INIT_GAMEPAD)) {
|
||||
/* game controller implies joystick */
|
||||
flags |= SDL_INIT_JOYSTICK;
|
||||
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) {
|
||||
SDL_GameControllerQuit();
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMEPAD)) {
|
||||
SDL_GamepadQuit();
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_GAMECONTROLLER);
|
||||
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_GAMEPAD);
|
||||
}
|
||||
|
||||
if ((flags & SDL_INIT_JOYSTICK)) {
|
||||
|
@ -754,62 +754,62 @@ SDL3_0.0.0 {
|
||||
SDL_Metal_DestroyView;
|
||||
SDL_Metal_GetLayer;
|
||||
SDL_Metal_GetDrawableSize;
|
||||
SDL_GameControllerAddMappingsFromRW;
|
||||
SDL_GameControllerAddMapping;
|
||||
SDL_GameControllerNumMappings;
|
||||
SDL_GameControllerMappingForIndex;
|
||||
SDL_GameControllerMappingForGUID;
|
||||
SDL_GameControllerMapping;
|
||||
SDL_IsGameController;
|
||||
SDL_GameControllerNameForIndex;
|
||||
SDL_GameControllerPathForIndex;
|
||||
SDL_GameControllerTypeForIndex;
|
||||
SDL_GameControllerMappingForDeviceIndex;
|
||||
SDL_GameControllerOpen;
|
||||
SDL_GameControllerFromInstanceID;
|
||||
SDL_GameControllerFromPlayerIndex;
|
||||
SDL_GameControllerName;
|
||||
SDL_GameControllerPath;
|
||||
SDL_GameControllerGetType;
|
||||
SDL_GameControllerGetPlayerIndex;
|
||||
SDL_GameControllerSetPlayerIndex;
|
||||
SDL_GameControllerGetVendor;
|
||||
SDL_GameControllerGetProduct;
|
||||
SDL_GameControllerGetProductVersion;
|
||||
SDL_GameControllerGetFirmwareVersion;
|
||||
SDL_GameControllerGetSerial;
|
||||
SDL_GameControllerGetAttached;
|
||||
SDL_GameControllerGetJoystick;
|
||||
SDL_GameControllerEventState;
|
||||
SDL_GameControllerUpdate;
|
||||
SDL_GameControllerGetAxisFromString;
|
||||
SDL_GameControllerGetStringForAxis;
|
||||
SDL_GameControllerGetBindForAxis;
|
||||
SDL_GameControllerHasAxis;
|
||||
SDL_GameControllerGetAxis;
|
||||
SDL_GameControllerGetButtonFromString;
|
||||
SDL_GameControllerGetStringForButton;
|
||||
SDL_GameControllerGetBindForButton;
|
||||
SDL_GameControllerHasButton;
|
||||
SDL_GameControllerGetButton;
|
||||
SDL_GameControllerGetNumTouchpads;
|
||||
SDL_GameControllerGetNumTouchpadFingers;
|
||||
SDL_GameControllerGetTouchpadFinger;
|
||||
SDL_GameControllerHasSensor;
|
||||
SDL_GameControllerSetSensorEnabled;
|
||||
SDL_GameControllerIsSensorEnabled;
|
||||
SDL_GameControllerGetSensorDataRate;
|
||||
SDL_GameControllerGetSensorData;
|
||||
SDL_GameControllerRumble;
|
||||
SDL_GameControllerRumbleTriggers;
|
||||
SDL_GameControllerHasLED;
|
||||
SDL_GameControllerHasRumble;
|
||||
SDL_GameControllerHasRumbleTriggers;
|
||||
SDL_GameControllerSetLED;
|
||||
SDL_GameControllerSendEffect;
|
||||
SDL_GameControllerClose;
|
||||
SDL_GameControllerGetAppleSFSymbolsNameForButton;
|
||||
SDL_GameControllerGetAppleSFSymbolsNameForAxis;
|
||||
SDL_AddGamepadMappingsFromRW;
|
||||
SDL_AddGamepadMapping;
|
||||
SDL_GetNumGamepadMappings;
|
||||
SDL_GetGamepadMappingForIndex;
|
||||
SDL_GetGamepadMappingForGUID;
|
||||
SDL_GetGamepadMapping;
|
||||
SDL_IsGamepad;
|
||||
SDL_GetGamepadNameForIndex;
|
||||
SDL_GetGamepadPathForIndex;
|
||||
SDL_GetGamepadTypeForIndex;
|
||||
SDL_GetGamepadMappingForDeviceIndex;
|
||||
SDL_OpenGamepad;
|
||||
SDL_GetGamepadFromInstanceID;
|
||||
SDL_GetGamepadFromPlayerIndex;
|
||||
SDL_GetGamepadName;
|
||||
SDL_GetGamepadPath;
|
||||
SDL_GetGamepadType;
|
||||
SDL_GetGamepadPlayerIndex;
|
||||
SDL_SetGamepadPlayerIndex;
|
||||
SDL_GetGamepadVendor;
|
||||
SDL_GetGamepadProduct;
|
||||
SDL_GetGamepadProductVersion;
|
||||
SDL_GetGamepadFirmwareVersion;
|
||||
SDL_GetGamepadSerial;
|
||||
SDL_IsGamepadConnected;
|
||||
SDL_GetGamepadJoystick;
|
||||
SDL_GetGamepadEventState;
|
||||
SDL_UpdateGamepads;
|
||||
SDL_GetGamepadAxisFromString;
|
||||
SDL_GetGamepadStringForAxis;
|
||||
SDL_GetGamepadBindForAxis;
|
||||
SDL_GamepadHasAxis;
|
||||
SDL_GetGamepadAxis;
|
||||
SDL_GetGamepadButtonFromString;
|
||||
SDL_GetGamepadStringForButton;
|
||||
SDL_GetGamepadBindForButton;
|
||||
SDL_GamepadHasButton;
|
||||
SDL_GetGamepadButton;
|
||||
SDL_GetGamepadNumTouchpads;
|
||||
SDL_GetGamepadNumTouchpadFingers;
|
||||
SDL_GetGamepadTouchpadFinger;
|
||||
SDL_GamepadHasSensor;
|
||||
SDL_SetGamepadSensorEnabled;
|
||||
SDL_IsGamepadSensorEnabled;
|
||||
SDL_GetGamepadSensorDataRate;
|
||||
SDL_GetGamepadSensorData;
|
||||
SDL_RumbleGamepad;
|
||||
SDL_RumbleGamepadTriggers;
|
||||
SDL_GamepadHasLED;
|
||||
SDL_GamepadHasRumble;
|
||||
SDL_GamepadHasRumbleTriggers;
|
||||
SDL_SetGamepadLED;
|
||||
SDL_SendGamepadEffect;
|
||||
SDL_CloseGamepad;
|
||||
SDL_GetGamepadAppleSFSymbolsNameForButton;
|
||||
SDL_GetGamepadAppleSFSymbolsNameForAxis;
|
||||
SDL_ReportAssertion;
|
||||
SDL_SetAssertionHandler;
|
||||
SDL_GetDefaultAssertionHandler;
|
||||
|
@ -126,26 +126,26 @@
|
||||
#define SDL_RegisterEvents SDL_RegisterEvents_REAL
|
||||
#define SDL_GetBasePath SDL_GetBasePath_REAL
|
||||
#define SDL_GetPrefPath SDL_GetPrefPath_REAL
|
||||
#define SDL_GameControllerAddMapping SDL_GameControllerAddMapping_REAL
|
||||
#define SDL_GameControllerMappingForGUID SDL_GameControllerMappingForGUID_REAL
|
||||
#define SDL_GameControllerMapping SDL_GameControllerMapping_REAL
|
||||
#define SDL_IsGameController SDL_IsGameController_REAL
|
||||
#define SDL_GameControllerNameForIndex SDL_GameControllerNameForIndex_REAL
|
||||
#define SDL_GameControllerOpen SDL_GameControllerOpen_REAL
|
||||
#define SDL_GameControllerName SDL_GameControllerName_REAL
|
||||
#define SDL_GameControllerGetAttached SDL_GameControllerGetAttached_REAL
|
||||
#define SDL_GameControllerGetJoystick SDL_GameControllerGetJoystick_REAL
|
||||
#define SDL_GameControllerEventState SDL_GameControllerEventState_REAL
|
||||
#define SDL_GameControllerUpdate SDL_GameControllerUpdate_REAL
|
||||
#define SDL_GameControllerGetAxisFromString SDL_GameControllerGetAxisFromString_REAL
|
||||
#define SDL_GameControllerGetStringForAxis SDL_GameControllerGetStringForAxis_REAL
|
||||
#define SDL_GameControllerGetBindForAxis SDL_GameControllerGetBindForAxis_REAL
|
||||
#define SDL_GameControllerGetAxis SDL_GameControllerGetAxis_REAL
|
||||
#define SDL_GameControllerGetButtonFromString SDL_GameControllerGetButtonFromString_REAL
|
||||
#define SDL_GameControllerGetStringForButton SDL_GameControllerGetStringForButton_REAL
|
||||
#define SDL_GameControllerGetBindForButton SDL_GameControllerGetBindForButton_REAL
|
||||
#define SDL_GameControllerGetButton SDL_GameControllerGetButton_REAL
|
||||
#define SDL_GameControllerClose SDL_GameControllerClose_REAL
|
||||
#define SDL_AddGamepadMapping SDL_AddGamepadMapping_REAL
|
||||
#define SDL_GetGamepadMappingForGUID SDL_GetGamepadMappingForGUID_REAL
|
||||
#define SDL_GetGamepadMapping SDL_GetGamepadMapping_REAL
|
||||
#define SDL_IsGamepad SDL_IsGamepad_REAL
|
||||
#define SDL_GetGamepadNameForIndex SDL_GetGamepadNameForIndex_REAL
|
||||
#define SDL_OpenGamepad SDL_OpenGamepad_REAL
|
||||
#define SDL_GetGamepadName SDL_GetGamepadName_REAL
|
||||
#define SDL_IsGamepadConnected SDL_IsGamepadConnected_REAL
|
||||
#define SDL_GetGamepadJoystick SDL_GetGamepadJoystick_REAL
|
||||
#define SDL_GetGamepadEventState SDL_GetGamepadEventState_REAL
|
||||
#define SDL_UpdateGamepads SDL_UpdateGamepads_REAL
|
||||
#define SDL_GetGamepadAxisFromString SDL_GetGamepadAxisFromString_REAL
|
||||
#define SDL_GetGamepadStringForAxis SDL_GetGamepadStringForAxis_REAL
|
||||
#define SDL_GetGamepadBindForAxis SDL_GetGamepadBindForAxis_REAL
|
||||
#define SDL_GetGamepadAxis SDL_GetGamepadAxis_REAL
|
||||
#define SDL_GetGamepadButtonFromString SDL_GetGamepadButtonFromString_REAL
|
||||
#define SDL_GetGamepadStringForButton SDL_GetGamepadStringForButton_REAL
|
||||
#define SDL_GetGamepadBindForButton SDL_GetGamepadBindForButton_REAL
|
||||
#define SDL_GetGamepadButton SDL_GetGamepadButton_REAL
|
||||
#define SDL_CloseGamepad SDL_CloseGamepad_REAL
|
||||
#define SDL_NumHaptics SDL_NumHaptics_REAL
|
||||
#define SDL_HapticName SDL_HapticName_REAL
|
||||
#define SDL_HapticOpen SDL_HapticOpen_REAL
|
||||
@ -540,7 +540,7 @@
|
||||
#define SDL_GL_SwapWindow SDL_GL_SwapWindow_REAL
|
||||
#define SDL_GL_DeleteContext SDL_GL_DeleteContext_REAL
|
||||
#define SDL_vsscanf SDL_vsscanf_REAL
|
||||
#define SDL_GameControllerAddMappingsFromRW SDL_GameControllerAddMappingsFromRW_REAL
|
||||
#define SDL_AddGamepadMappingsFromRW SDL_AddGamepadMappingsFromRW_REAL
|
||||
#define SDL_GL_ResetAttributes SDL_GL_ResetAttributes_REAL
|
||||
#define SDL_HasAVX SDL_HasAVX_REAL
|
||||
#define SDL_GetDefaultAssertionHandler SDL_GetDefaultAssertionHandler_REAL
|
||||
@ -563,7 +563,7 @@
|
||||
#define SDL_GetGrabbedWindow SDL_GetGrabbedWindow_REAL
|
||||
#define SDL_SetWindowsMessageHook SDL_SetWindowsMessageHook_REAL
|
||||
#define SDL_GetJoystickPowerLevel SDL_GetJoystickPowerLevel_REAL
|
||||
#define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL
|
||||
#define SDL_GetGamepadFromInstanceID SDL_GetGamepadFromInstanceID_REAL
|
||||
#define SDL_GetJoystickFromInstanceID SDL_GetJoystickFromInstanceID_REAL
|
||||
#define SDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds_REAL
|
||||
#define SDL_GetWindowBordersSize SDL_GetWindowBordersSize_REAL
|
||||
@ -584,12 +584,12 @@
|
||||
#define SDL_GetJoystickVendor SDL_GetJoystickVendor_REAL
|
||||
#define SDL_GetJoystickProduct SDL_GetJoystickProduct_REAL
|
||||
#define SDL_GetJoystickProductVersion SDL_GetJoystickProductVersion_REAL
|
||||
#define SDL_GameControllerGetVendor SDL_GameControllerGetVendor_REAL
|
||||
#define SDL_GameControllerGetProduct SDL_GameControllerGetProduct_REAL
|
||||
#define SDL_GameControllerGetProductVersion SDL_GameControllerGetProductVersion_REAL
|
||||
#define SDL_GetGamepadVendor SDL_GetGamepadVendor_REAL
|
||||
#define SDL_GetGamepadProduct SDL_GetGamepadProduct_REAL
|
||||
#define SDL_GetGamepadProductVersion SDL_GetGamepadProductVersion_REAL
|
||||
#define SDL_HasNEON SDL_HasNEON_REAL
|
||||
#define SDL_GameControllerNumMappings SDL_GameControllerNumMappings_REAL
|
||||
#define SDL_GameControllerMappingForIndex SDL_GameControllerMappingForIndex_REAL
|
||||
#define SDL_GetNumGamepadMappings SDL_GetNumGamepadMappings_REAL
|
||||
#define SDL_GetGamepadMappingForIndex SDL_GetGamepadMappingForIndex_REAL
|
||||
#define SDL_GetJoystickAxisInitialState SDL_GetJoystickAxisInitialState_REAL
|
||||
#define SDL_GetJoystickDeviceType SDL_GetJoystickDeviceType_REAL
|
||||
#define SDL_GetJoystickType SDL_GetJoystickType_REAL
|
||||
@ -641,7 +641,7 @@
|
||||
#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_GetGamepadMappingForDeviceIndex SDL_GetGamepadMappingForDeviceIndex_REAL
|
||||
#define SDL_LinuxSetThreadPriority SDL_LinuxSetThreadPriority_REAL
|
||||
#define SDL_HasAVX512F SDL_HasAVX512F_REAL
|
||||
#define SDL_IsChromebook SDL_IsChromebook_REAL
|
||||
@ -650,7 +650,7 @@
|
||||
#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_RumbleGamepad SDL_RumbleGamepad_REAL
|
||||
#define SDL_RumbleJoystick SDL_RumbleJoystick_REAL
|
||||
#define SDL_GetNumSensors SDL_GetNumSensors_REAL
|
||||
#define SDL_GetSensorDeviceName SDL_GetSensorDeviceName_REAL
|
||||
@ -672,7 +672,7 @@
|
||||
#define SDL_CreateThreadWithStackSize SDL_CreateThreadWithStackSize_REAL
|
||||
#define SDL_GetJoystickDevicePlayerIndex SDL_GetJoystickDevicePlayerIndex_REAL
|
||||
#define SDL_GetJoystickPlayerIndex SDL_GetJoystickPlayerIndex_REAL
|
||||
#define SDL_GameControllerGetPlayerIndex SDL_GameControllerGetPlayerIndex_REAL
|
||||
#define SDL_GetGamepadPlayerIndex SDL_GetGamepadPlayerIndex_REAL
|
||||
#define SDL_RenderFlush SDL_RenderFlush_REAL
|
||||
#define SDL_RenderPointF SDL_RenderPointF_REAL
|
||||
#define SDL_RenderPointsF SDL_RenderPointsF_REAL
|
||||
@ -702,10 +702,10 @@
|
||||
#define SDL_strtokr SDL_strtokr_REAL
|
||||
#define SDL_wcsstr SDL_wcsstr_REAL
|
||||
#define SDL_wcsncmp SDL_wcsncmp_REAL
|
||||
#define SDL_GameControllerTypeForIndex SDL_GameControllerTypeForIndex_REAL
|
||||
#define SDL_GameControllerGetType SDL_GameControllerGetType_REAL
|
||||
#define SDL_GameControllerFromPlayerIndex SDL_GameControllerFromPlayerIndex_REAL
|
||||
#define SDL_GameControllerSetPlayerIndex SDL_GameControllerSetPlayerIndex_REAL
|
||||
#define SDL_GetGamepadTypeForIndex SDL_GetGamepadTypeForIndex_REAL
|
||||
#define SDL_GetGamepadType SDL_GetGamepadType_REAL
|
||||
#define SDL_GetGamepadFromPlayerIndex SDL_GetGamepadFromPlayerIndex_REAL
|
||||
#define SDL_SetGamepadPlayerIndex SDL_SetGamepadPlayerIndex_REAL
|
||||
#define SDL_GetJoystickFromPlayerIndex SDL_GetJoystickFromPlayerIndex_REAL
|
||||
#define SDL_SetJoystickPlayerIndex SDL_SetJoystickPlayerIndex_REAL
|
||||
#define SDL_SetTextureScaleMode SDL_SetTextureScaleMode_REAL
|
||||
@ -738,24 +738,24 @@
|
||||
#define SDL_AndroidRequestPermission SDL_AndroidRequestPermission_REAL
|
||||
#define SDL_OpenURL SDL_OpenURL_REAL
|
||||
#define SDL_SurfaceHasRLE SDL_SurfaceHasRLE_REAL
|
||||
#define SDL_GameControllerHasLED SDL_GameControllerHasLED_REAL
|
||||
#define SDL_GameControllerSetLED SDL_GameControllerSetLED_REAL
|
||||
#define SDL_GamepadHasLED SDL_GamepadHasLED_REAL
|
||||
#define SDL_SetGamepadLED SDL_SetGamepadLED_REAL
|
||||
#define SDL_JoystickHasLED SDL_JoystickHasLED_REAL
|
||||
#define SDL_SetJoystickLED SDL_SetJoystickLED_REAL
|
||||
#define SDL_GameControllerRumbleTriggers SDL_GameControllerRumbleTriggers_REAL
|
||||
#define SDL_RumbleGamepadTriggers SDL_RumbleGamepadTriggers_REAL
|
||||
#define SDL_RumbleJoystickTriggers SDL_RumbleJoystickTriggers_REAL
|
||||
#define SDL_GameControllerHasAxis SDL_GameControllerHasAxis_REAL
|
||||
#define SDL_GameControllerHasButton SDL_GameControllerHasButton_REAL
|
||||
#define SDL_GameControllerGetNumTouchpads SDL_GameControllerGetNumTouchpads_REAL
|
||||
#define SDL_GameControllerGetNumTouchpadFingers SDL_GameControllerGetNumTouchpadFingers_REAL
|
||||
#define SDL_GameControllerGetTouchpadFinger SDL_GameControllerGetTouchpadFinger_REAL
|
||||
#define SDL_GamepadHasAxis SDL_GamepadHasAxis_REAL
|
||||
#define SDL_GamepadHasButton SDL_GamepadHasButton_REAL
|
||||
#define SDL_GetGamepadNumTouchpads SDL_GetGamepadNumTouchpads_REAL
|
||||
#define SDL_GetGamepadNumTouchpadFingers SDL_GetGamepadNumTouchpadFingers_REAL
|
||||
#define SDL_GetGamepadTouchpadFinger SDL_GetGamepadTouchpadFinger_REAL
|
||||
#define SDL_crc32 SDL_crc32_REAL
|
||||
#define SDL_GameControllerGetSerial SDL_GameControllerGetSerial_REAL
|
||||
#define SDL_GetGamepadSerial SDL_GetGamepadSerial_REAL
|
||||
#define SDL_GetJoystickSerial SDL_GetJoystickSerial_REAL
|
||||
#define SDL_GameControllerHasSensor SDL_GameControllerHasSensor_REAL
|
||||
#define SDL_GameControllerSetSensorEnabled SDL_GameControllerSetSensorEnabled_REAL
|
||||
#define SDL_GameControllerIsSensorEnabled SDL_GameControllerIsSensorEnabled_REAL
|
||||
#define SDL_GameControllerGetSensorData SDL_GameControllerGetSensorData_REAL
|
||||
#define SDL_GamepadHasSensor SDL_GamepadHasSensor_REAL
|
||||
#define SDL_SetGamepadSensorEnabled SDL_SetGamepadSensorEnabled_REAL
|
||||
#define SDL_IsGamepadSensorEnabled SDL_IsGamepadSensorEnabled_REAL
|
||||
#define SDL_GetGamepadSensorData SDL_GetGamepadSensorData_REAL
|
||||
#define SDL_wcscasecmp SDL_wcscasecmp_REAL
|
||||
#define SDL_wcsncasecmp SDL_wcsncasecmp_REAL
|
||||
#define SDL_round SDL_round_REAL
|
||||
@ -782,9 +782,9 @@
|
||||
#define SDL_TLSCleanup SDL_TLSCleanup_REAL
|
||||
#define SDL_SetWindowAlwaysOnTop SDL_SetWindowAlwaysOnTop_REAL
|
||||
#define SDL_FlashWindow SDL_FlashWindow_REAL
|
||||
#define SDL_GameControllerSendEffect SDL_GameControllerSendEffect_REAL
|
||||
#define SDL_SendGamepadEffect SDL_SendGamepadEffect_REAL
|
||||
#define SDL_SendJoystickEffect SDL_SendJoystickEffect_REAL
|
||||
#define SDL_GameControllerGetSensorDataRate SDL_GameControllerGetSensorDataRate_REAL
|
||||
#define SDL_GetGamepadSensorDataRate SDL_GetGamepadSensorDataRate_REAL
|
||||
#define SDL_SetTextureUserData SDL_SetTextureUserData_REAL
|
||||
#define SDL_GetTextureUserData SDL_GetTextureUserData_REAL
|
||||
#define SDL_RenderGeometry SDL_RenderGeometry_REAL
|
||||
@ -794,8 +794,8 @@
|
||||
#define SDL_vasprintf SDL_vasprintf_REAL
|
||||
#define SDL_GetWindowICCProfile SDL_GetWindowICCProfile_REAL
|
||||
#define SDL_LinuxSetThreadPriorityAndPolicy SDL_LinuxSetThreadPriorityAndPolicy_REAL
|
||||
#define SDL_GameControllerGetAppleSFSymbolsNameForButton SDL_GameControllerGetAppleSFSymbolsNameForButton_REAL
|
||||
#define SDL_GameControllerGetAppleSFSymbolsNameForAxis SDL_GameControllerGetAppleSFSymbolsNameForAxis_REAL
|
||||
#define SDL_GetGamepadAppleSFSymbolsNameForButton SDL_GetGamepadAppleSFSymbolsNameForButton_REAL
|
||||
#define SDL_GetGamepadAppleSFSymbolsNameForAxis SDL_GetGamepadAppleSFSymbolsNameForAxis_REAL
|
||||
#define SDL_hid_init SDL_hid_init_REAL
|
||||
#define SDL_hid_exit SDL_hid_exit_REAL
|
||||
#define SDL_hid_device_change_count SDL_hid_device_change_count_REAL
|
||||
@ -820,8 +820,8 @@
|
||||
#define SDL_RenderLogicalToWindow SDL_RenderLogicalToWindow_REAL
|
||||
#define SDL_JoystickHasRumble SDL_JoystickHasRumble_REAL
|
||||
#define SDL_JoystickHasRumbleTriggers SDL_JoystickHasRumbleTriggers_REAL
|
||||
#define SDL_GameControllerHasRumble SDL_GameControllerHasRumble_REAL
|
||||
#define SDL_GameControllerHasRumbleTriggers SDL_GameControllerHasRumbleTriggers_REAL
|
||||
#define SDL_GamepadHasRumble SDL_GamepadHasRumble_REAL
|
||||
#define SDL_GamepadHasRumbleTriggers SDL_GamepadHasRumbleTriggers_REAL
|
||||
#define SDL_hid_ble_scan SDL_hid_ble_scan_REAL
|
||||
#define SDL_PremultiplyAlpha SDL_PremultiplyAlpha_REAL
|
||||
#define SDL_AndroidSendMessage SDL_AndroidSendMessage_REAL
|
||||
@ -835,12 +835,12 @@
|
||||
#define SDL_IntersectFRectAndLine SDL_IntersectFRectAndLine_REAL
|
||||
#define SDL_GetRenderWindow SDL_GetRenderWindow_REAL
|
||||
#define SDL_bsearch SDL_bsearch_REAL
|
||||
#define SDL_GameControllerPathForIndex SDL_GameControllerPathForIndex_REAL
|
||||
#define SDL_GameControllerPath SDL_GameControllerPath_REAL
|
||||
#define SDL_GetGamepadPathForIndex SDL_GetGamepadPathForIndex_REAL
|
||||
#define SDL_GetGamepadPath SDL_GetGamepadPath_REAL
|
||||
#define SDL_GetJoystickPathForIndex SDL_GetJoystickPathForIndex_REAL
|
||||
#define SDL_GetJoystickPath SDL_GetJoystickPath_REAL
|
||||
#define SDL_AttachVirtualJoystickEx SDL_AttachVirtualJoystickEx_REAL
|
||||
#define SDL_GameControllerGetFirmwareVersion SDL_GameControllerGetFirmwareVersion_REAL
|
||||
#define SDL_GetGamepadFirmwareVersion SDL_GetGamepadFirmwareVersion_REAL
|
||||
#define SDL_GetJoystickFirmwareVersion SDL_GetJoystickFirmwareVersion_REAL
|
||||
#define SDL_GUIDToString SDL_GUIDToString_REAL
|
||||
#define SDL_GUIDFromString SDL_GUIDFromString_REAL
|
||||
|
@ -153,26 +153,26 @@ SDL_DYNAPI_PROC(Uint8,SDL_EventState,(Uint32 a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_RegisterEvents,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetBasePath,(void),(),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetPrefPath,(const char *a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerAddMapping,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForGUID,(SDL_JoystickGUID a),(a),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GameControllerMapping,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IsGameController,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerNameForIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerOpen,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerName,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerGetAttached,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GameControllerGetJoystick,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerEventState,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GameControllerUpdate,(void),(),)
|
||||
SDL_DYNAPI_PROC(SDL_GameControllerAxis,SDL_GameControllerGetAxisFromString,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetStringForAxis,(SDL_GameControllerAxis a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GameControllerButtonBind,SDL_GameControllerGetBindForAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(Sint16,SDL_GameControllerGetAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_GameControllerButton,SDL_GameControllerGetButtonFromString,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetStringForButton,(SDL_GameControllerButton a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GameControllerButtonBind,SDL_GameControllerGetBindForButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(Uint8,SDL_GameControllerGetButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GameControllerClose,(SDL_GameController *a),(a),)
|
||||
SDL_DYNAPI_PROC(int,SDL_AddGamepadMapping,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetGamepadMappingForGUID,(SDL_JoystickGUID a),(a),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetGamepadMapping,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IsGamepad,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadNameForIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Gamepad*,SDL_OpenGamepad,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadName,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IsGamepadConnected,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetGamepadJoystick,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetGamepadEventState,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_UpdateGamepads,(void),(),)
|
||||
SDL_DYNAPI_PROC(SDL_GamepadAxis,SDL_GetGamepadAxisFromString,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadStringForAxis,(SDL_GamepadAxis a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GamepadBinding,SDL_GetGamepadBindForAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(Sint16,SDL_GetGamepadAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_GamepadButton,SDL_GetGamepadButtonFromString,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadStringForButton,(SDL_GamepadButton a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GamepadBinding,SDL_GetGamepadBindForButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(Uint8,SDL_GetGamepadButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_CloseGamepad,(SDL_Gamepad *a),(a),)
|
||||
SDL_DYNAPI_PROC(int,SDL_NumHaptics,(void),(),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_HapticName,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Haptic*,SDL_HapticOpen,(int a),(a),return)
|
||||
@ -566,7 +566,7 @@ SDL_DYNAPI_PROC(int,SDL_GL_GetSwapInterval,(void),(),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GL_SwapWindow,(SDL_Window *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_GL_DeleteContext,(SDL_GLContext a),(a),)
|
||||
SDL_DYNAPI_PROC(int,SDL_vsscanf,(const char *a, const char *b, va_list c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerAddMappingsFromRW,(SDL_RWops *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromRW,(SDL_RWops *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GL_ResetAttributes,(void),(),)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetDefaultAssertionHandler,(void),(),return)
|
||||
@ -596,7 +596,7 @@ SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void *
|
||||
#endif
|
||||
SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_GetJoystickPowerLevel,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromInstanceID,(SDL_JoystickID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Gamepad*,SDL_GetGamepadFromInstanceID,(SDL_JoystickID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetJoystickFromInstanceID,(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)
|
||||
@ -617,12 +617,12 @@ SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickDeviceProductVersion,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendor,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickProduct,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickProductVersion,(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(Uint16,SDL_GetGamepadVendor,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadProduct,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadProductVersion,(SDL_Gamepad *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(int,SDL_GetNumGamepadMappings,(void),(),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetGamepadMappingForIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GetJoystickAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_JoystickType,SDL_GetJoystickDeviceType,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_JoystickType,SDL_GetJoystickType,(SDL_Joystick *a),(a),return)
|
||||
@ -678,7 +678,7 @@ 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)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetGamepadMappingForDeviceIndex,(int a),(a),return)
|
||||
#ifdef __LINUX__
|
||||
SDL_DYNAPI_PROC(int,SDL_LinuxSetThreadPriority,(Sint64 a, int b),(a,b),return)
|
||||
#endif
|
||||
@ -691,7 +691,7 @@ SDL_DYNAPI_PROC(void,SDL_AndroidBackButton,(void),(),)
|
||||
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_RumbleGamepad,(SDL_Gamepad *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RumbleJoystick,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetNumSensors,(void),(),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetSensorDeviceName,(int a),(a),return)
|
||||
@ -723,7 +723,7 @@ SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a,
|
||||
|
||||
SDL_DYNAPI_PROC(int,SDL_GetJoystickDevicePlayerIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetJoystickPlayerIndex,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetPlayerIndex,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetGamepadPlayerIndex,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RenderFlush,(SDL_Renderer *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RenderPointF,(SDL_Renderer *a, float b, float c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RenderPointsF,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return)
|
||||
@ -753,10 +753,10 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasARMSIMD,(void),(),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_strtokr,(char *a, const char *b, char **c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(wchar_t*,SDL_wcsstr,(const wchar_t *a, const wchar_t *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_wcsncmp,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_GameControllerType,SDL_GameControllerTypeForIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GameControllerType,SDL_GameControllerGetType,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromPlayerIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GameControllerSetPlayerIndex,(SDL_GameController *a, int b),(a,b),)
|
||||
SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetGamepadTypeForIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetGamepadType,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Gamepad*,SDL_GetGamepadFromPlayerIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_SetGamepadPlayerIndex,(SDL_Gamepad *a, int b),(a,b),)
|
||||
SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetJoystickFromPlayerIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_SetJoystickPlayerIndex,(SDL_Joystick *a, int b),(a,b),)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode b),(a,b),return)
|
||||
@ -795,24 +795,24 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_AndroidRequestPermission,(const char *a),(a),return
|
||||
#endif
|
||||
SDL_DYNAPI_PROC(int,SDL_OpenURL,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasRLE,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasLED,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerSetLED,(SDL_GameController *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasLED,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetGamepadLED,(SDL_Gamepad *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickHasLED,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetJoystickLED,(SDL_Joystick *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerRumbleTriggers,(SDL_GameController *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RumbleGamepadTriggers,(SDL_Gamepad *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RumbleJoystickTriggers,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetNumTouchpads,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetNumTouchpadFingers,(SDL_GameController *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetTouchpadFinger,(SDL_GameController *a, int b, int c, Uint8 *d, float *e, float *f, float *g),(a,b,c,d,e,f,g),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetGamepadNumTouchpads,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetGamepadNumTouchpadFingers,(SDL_Gamepad *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetGamepadTouchpadFinger,(SDL_Gamepad *a, int b, int c, Uint8 *d, float *e, float *f, float *g),(a,b,c,d,e,f,g),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_crc32,(Uint32 a, const void *b, size_t c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetSerial,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadSerial,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetJoystickSerial,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasSensor,(SDL_GameController *a, SDL_SensorType b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerSetSensorEnabled,(SDL_GameController *a, SDL_SensorType b, SDL_bool c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerIsSensorEnabled,(SDL_GameController *a, SDL_SensorType b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetSensorData,(SDL_GameController *a, SDL_SensorType b, float *c, int d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasSensor,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetGamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorType b, SDL_bool c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IsGamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetGamepadSensorData,(SDL_Gamepad *a, SDL_SensorType b, float *c, int d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_wcscasecmp,(const wchar_t *a, const wchar_t *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_wcsncasecmp,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(double,SDL_round,(double a),(a),return)
|
||||
@ -843,9 +843,9 @@ SDL_DYNAPI_PROC(int,SDL_GetAudioDeviceSpec,(int a, int b, SDL_AudioSpec *c),(a,b
|
||||
SDL_DYNAPI_PROC(void,SDL_TLSCleanup,(void),(),)
|
||||
SDL_DYNAPI_PROC(void,SDL_SetWindowAlwaysOnTop,(SDL_Window *a, SDL_bool b),(a,b),)
|
||||
SDL_DYNAPI_PROC(int,SDL_FlashWindow,(SDL_Window *a, SDL_FlashOperation b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerSendEffect,(SDL_GameController *a, const void *b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SendGamepadEffect,(SDL_Gamepad *a, const void *b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SendJoystickEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(float,SDL_GameControllerGetSensorDataRate,(SDL_GameController *a, SDL_SensorType b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(float,SDL_GetGamepadSensorDataRate,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTextureUserData,(SDL_Texture *a, void *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_GetTextureUserData,(SDL_Texture *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RenderGeometry,(SDL_Renderer *a, SDL_Texture *b, const SDL_Vertex *c, int d, const int *e, int f),(a,b,c,d,e,f),return)
|
||||
@ -859,8 +859,8 @@ SDL_DYNAPI_PROC(void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),r
|
||||
#ifdef __LINUX__
|
||||
SDL_DYNAPI_PROC(int,SDL_LinuxSetThreadPriorityAndPolicy,(Sint64 a, int b, int c),(a,b,c),return)
|
||||
#endif
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetAppleSFSymbolsNameForButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerGetAppleSFSymbolsNameForAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadAppleSFSymbolsNameForButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadAppleSFSymbolsNameForAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_hid_init,(void),(),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_hid_exit,(void),(),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_hid_device_change_count,(void),(),return)
|
||||
@ -885,8 +885,8 @@ SDL_DYNAPI_PROC(void,SDL_RenderWindowToLogical,(SDL_Renderer *a, int b, int c, f
|
||||
SDL_DYNAPI_PROC(void,SDL_RenderLogicalToWindow,(SDL_Renderer *a, float b, float c, int *d, int *e),(a,b,c,d,e),)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickHasRumble,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickHasRumbleTriggers,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasRumble,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasRumbleTriggers,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasRumble,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasRumbleTriggers,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_hid_ble_scan,(SDL_bool a),(a),)
|
||||
SDL_DYNAPI_PROC(int,SDL_PremultiplyAlpha,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h),(a,b,c,d,e,f,g,h),return)
|
||||
#ifdef __ANDROID__
|
||||
@ -902,12 +902,12 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_EncloseFPoints,(const SDL_FPoint *a, int b, const S
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRectAndLine,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetRenderWindow,(SDL_Renderer *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_bsearch,(const void *a, const void *b, size_t c, size_t d, int (SDLCALL *e)(const void *, const void *)),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerPathForIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GameControllerPath,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadPathForIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadPath,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetJoystickPathForIndex,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetJoystickPath,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AttachVirtualJoystickEx,(const SDL_VirtualJoystickDesc *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetFirmwareVersion,(SDL_GameController *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadFirmwareVersion,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickFirmwareVersion,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GUIDToString,(SDL_GUID a, char *b, int c),(a,b,c),)
|
||||
SDL_DYNAPI_PROC(SDL_GUID,SDL_GUIDFromString,(const char *a),(a),return)
|
||||
|
@ -165,8 +165,8 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||
if ((SDL_EventLoggingVerbosity < 2) &&
|
||||
((event->type == SDL_MOUSEMOTION) ||
|
||||
(event->type == SDL_FINGERMOTION) ||
|
||||
(event->type == SDL_CONTROLLERTOUCHPADMOTION) ||
|
||||
(event->type == SDL_CONTROLLERSENSORUPDATE) ||
|
||||
(event->type == SDL_GAMEPADTOUCHPADMOTION) ||
|
||||
(event->type == SDL_GAMEPADSENSORUPDATE) ||
|
||||
(event->type == SDL_SENSORUPDATE))) {
|
||||
return;
|
||||
}
|
||||
@ -362,7 +362,7 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||
break;
|
||||
#undef PRINT_JOYDEV_EVENT
|
||||
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERAXISMOTION)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADAXISMOTION)
|
||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d axis=%u value=%d)",
|
||||
(uint)event->caxis.timestamp, (int)event->caxis.which,
|
||||
(uint)event->caxis.axis, (int)event->caxis.value);
|
||||
@ -372,22 +372,22 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||
(void)SDL_snprintf(details, sizeof(details), " (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)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADBUTTONDOWN)
|
||||
PRINT_CBUTTON_EVENT(event);
|
||||
break;
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERBUTTONUP)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADBUTTONUP)
|
||||
PRINT_CBUTTON_EVENT(event);
|
||||
break;
|
||||
#undef PRINT_CBUTTON_EVENT
|
||||
|
||||
#define PRINT_CONTROLLERDEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d)", (uint)event->cdevice.timestamp, (int)event->cdevice.which)
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERDEVICEADDED)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADADDED)
|
||||
PRINT_CONTROLLERDEV_EVENT(event);
|
||||
break;
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADREMOVED)
|
||||
PRINT_CONTROLLERDEV_EVENT(event);
|
||||
break;
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADDEVICEREMAPPED)
|
||||
PRINT_CONTROLLERDEV_EVENT(event);
|
||||
break;
|
||||
#undef PRINT_CONTROLLERDEV_EVENT
|
||||
@ -397,18 +397,18 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||
(uint)event->ctouchpad.timestamp, (int)event->ctouchpad.which, \
|
||||
(int)event->ctouchpad.touchpad, (int)event->ctouchpad.finger, \
|
||||
event->ctouchpad.x, event->ctouchpad.y, event->ctouchpad.pressure)
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERTOUCHPADDOWN)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADTOUCHPADDOWN)
|
||||
PRINT_CTOUCHPAD_EVENT(event);
|
||||
break;
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERTOUCHPADUP)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADTOUCHPADUP)
|
||||
PRINT_CTOUCHPAD_EVENT(event);
|
||||
break;
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERTOUCHPADMOTION)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADTOUCHPADMOTION)
|
||||
PRINT_CTOUCHPAD_EVENT(event);
|
||||
break;
|
||||
#undef PRINT_CTOUCHPAD_EVENT
|
||||
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERSENSORUPDATE)
|
||||
SDL_EVENT_CASE(SDL_GAMEPADSENSORUPDATE)
|
||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d sensor=%d data[0]=%f data[1]=%f data[2]=%f)",
|
||||
(uint)event->csensor.timestamp, (int)event->csensor.which, (int)event->csensor.sensor,
|
||||
event->csensor.data[0], event->csensor.data[1], event->csensor.data[2]);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -309,7 +309,7 @@ int SDL_JoystickInit(void)
|
||||
|
||||
SDL_joysticks_initialized = SDL_TRUE;
|
||||
|
||||
SDL_GameControllerInitMappings();
|
||||
SDL_GamepadInitMappings();
|
||||
|
||||
/* See if we should allow joystick events while in the background */
|
||||
SDL_AddHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS,
|
||||
@ -548,7 +548,7 @@ SDL_Joystick *SDL_OpenJoystick(int device_index)
|
||||
}
|
||||
}
|
||||
|
||||
joystick->is_game_controller = SDL_IsGameController(device_index);
|
||||
joystick->is_game_controller = SDL_IsGamepad(device_index);
|
||||
|
||||
/* Add joystick to list */
|
||||
++joystick->ref_count;
|
||||
@ -1268,7 +1268,7 @@ void SDL_JoystickQuit(void)
|
||||
SDL_DelHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS,
|
||||
SDL_JoystickAllowBackgroundEventsChanged, NULL);
|
||||
|
||||
SDL_GameControllerQuitMappings();
|
||||
SDL_GamepadQuitMappings();
|
||||
|
||||
SDL_joysticks_quitting = SDL_FALSE;
|
||||
SDL_joysticks_initialized = SDL_FALSE;
|
||||
@ -1358,7 +1358,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance)
|
||||
if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &driver_device_index)) {
|
||||
player_index = driver->GetDevicePlayerIndex(driver_device_index);
|
||||
}
|
||||
if (player_index < 0 && SDL_IsGameController(device_index)) {
|
||||
if (player_index < 0 && SDL_IsGamepad(device_index)) {
|
||||
player_index = SDL_FindFreePlayerIndex();
|
||||
}
|
||||
if (player_index >= 0) {
|
||||
@ -1408,7 +1408,7 @@ static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type)
|
||||
case SDL_JOYDEVICEADDED:
|
||||
which = events[i].jdevice.which;
|
||||
break;
|
||||
case SDL_CONTROLLERDEVICEADDED:
|
||||
case SDL_GAMEPADADDED:
|
||||
which = events[i].cdevice.which;
|
||||
break;
|
||||
default:
|
||||
@ -1427,7 +1427,7 @@ static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type)
|
||||
case SDL_JOYDEVICEADDED:
|
||||
--events[i].jdevice.which;
|
||||
break;
|
||||
case SDL_CONTROLLERDEVICEADDED:
|
||||
case SDL_GAMEPADADDED:
|
||||
--events[i].cdevice.which;
|
||||
break;
|
||||
default:
|
||||
@ -1504,7 +1504,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
|
||||
}
|
||||
|
||||
UpdateEventsForDeviceRemoval(device_index, SDL_JOYDEVICEADDED);
|
||||
UpdateEventsForDeviceRemoval(device_index, SDL_CONTROLLERDEVICEADDED);
|
||||
UpdateEventsForDeviceRemoval(device_index, SDL_GAMEPADADDED);
|
||||
#endif /* !SDL_EVENTS_DISABLED */
|
||||
|
||||
player_index = SDL_GetPlayerIndexForJoystickID(device_instance);
|
||||
@ -1700,7 +1700,7 @@ void SDL_UpdateJoysticks(void)
|
||||
joystick->driver->Update(joystick);
|
||||
|
||||
if (joystick->delayed_guide_button) {
|
||||
SDL_GameControllerHandleDelayedGuideButton(joystick);
|
||||
SDL_GamepadHandleDelayedGuideButton(joystick);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1892,23 +1892,23 @@ char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_n
|
||||
name = SDL_strdup(product_name);
|
||||
} else if (vendor || product) {
|
||||
/* Couldn't find a controller name, try to give it one based on device type */
|
||||
switch (SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, NULL, SDL_TRUE)) {
|
||||
case SDL_CONTROLLER_TYPE_XBOX360:
|
||||
switch (SDL_GetGamepadTypeFromVIDPID(vendor, product, NULL, SDL_TRUE)) {
|
||||
case SDL_GAMEPAD_TYPE_XBOX360:
|
||||
name = SDL_strdup("Xbox 360 Controller");
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_XBOXONE:
|
||||
case SDL_GAMEPAD_TYPE_XBOXONE:
|
||||
name = SDL_strdup("Xbox One Controller");
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_PS3:
|
||||
case SDL_GAMEPAD_TYPE_PS3:
|
||||
name = SDL_strdup("PS3 Controller");
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_PS4:
|
||||
case SDL_GAMEPAD_TYPE_PS4:
|
||||
name = SDL_strdup("PS4 Controller");
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_PS5:
|
||||
case SDL_GAMEPAD_TYPE_PS5:
|
||||
name = SDL_strdup("DualSense Wireless Controller");
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO:
|
||||
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO:
|
||||
name = SDL_strdup("Nintendo Switch Pro Controller");
|
||||
break;
|
||||
default:
|
||||
@ -2050,9 +2050,9 @@ void SDL_SetJoystickGUIDCRC(SDL_JoystickGUID *guid, Uint16 crc)
|
||||
guid16[1] = SDL_SwapLE16(crc);
|
||||
}
|
||||
|
||||
SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI)
|
||||
SDL_GamepadType SDL_GetGamepadTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI)
|
||||
{
|
||||
SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
SDL_GamepadType type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
|
||||
if (vendor == 0x0000 && product == 0x0000) {
|
||||
/* Some devices are only identifiable by their name */
|
||||
@ -2061,81 +2061,81 @@ SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor
|
||||
SDL_strcmp(name, "Nintendo Wireless Gamepad") == 0 ||
|
||||
SDL_strcmp(name, "Wireless Gamepad") == 0)) {
|
||||
/* HORI or PowerA Switch Pro Controller clone */
|
||||
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO;
|
||||
type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO;
|
||||
}
|
||||
|
||||
} else if (vendor == 0x0001 && product == 0x0001) {
|
||||
type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
|
||||
} else if (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) {
|
||||
type = SDL_CONTROLLER_TYPE_XBOXONE;
|
||||
type = SDL_GAMEPAD_TYPE_XBOXONE;
|
||||
|
||||
} else if ((vendor == USB_VENDOR_AMAZON && product == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) ||
|
||||
(vendor == BLUETOOTH_VENDOR_AMAZON && product == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) {
|
||||
type = SDL_CONTROLLER_TYPE_AMAZON_LUNA;
|
||||
type = SDL_GAMEPAD_TYPE_AMAZON_LUNA;
|
||||
|
||||
} else if (vendor == USB_VENDOR_GOOGLE && product == USB_PRODUCT_GOOGLE_STADIA_CONTROLLER) {
|
||||
type = SDL_CONTROLLER_TYPE_GOOGLE_STADIA;
|
||||
type = SDL_GAMEPAD_TYPE_GOOGLE_STADIA;
|
||||
|
||||
} else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT) {
|
||||
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
|
||||
type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
|
||||
|
||||
} else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT) {
|
||||
if (name && SDL_strstr(name, "NES Controller") != NULL) {
|
||||
/* We don't have a type for the Nintendo Online NES Controller */
|
||||
type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
} else {
|
||||
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
|
||||
type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
|
||||
}
|
||||
|
||||
} else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) {
|
||||
if (name && SDL_strstr(name, "(L)") != NULL) {
|
||||
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
|
||||
type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
|
||||
} else {
|
||||
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
|
||||
type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
|
||||
}
|
||||
|
||||
} else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR) {
|
||||
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR;
|
||||
type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR;
|
||||
|
||||
} else if (vendor == USB_VENDOR_NVIDIA &&
|
||||
(product == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V103 ||
|
||||
product == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V104)) {
|
||||
type = SDL_CONTROLLER_TYPE_NVIDIA_SHIELD;
|
||||
type = SDL_GAMEPAD_TYPE_NVIDIA_SHIELD;
|
||||
|
||||
} else {
|
||||
switch (GuessControllerType(vendor, product)) {
|
||||
case k_eControllerType_XBox360Controller:
|
||||
type = SDL_CONTROLLER_TYPE_XBOX360;
|
||||
type = SDL_GAMEPAD_TYPE_XBOX360;
|
||||
break;
|
||||
case k_eControllerType_XBoxOneController:
|
||||
type = SDL_CONTROLLER_TYPE_XBOXONE;
|
||||
type = SDL_GAMEPAD_TYPE_XBOXONE;
|
||||
break;
|
||||
case k_eControllerType_PS3Controller:
|
||||
type = SDL_CONTROLLER_TYPE_PS3;
|
||||
type = SDL_GAMEPAD_TYPE_PS3;
|
||||
break;
|
||||
case k_eControllerType_PS4Controller:
|
||||
type = SDL_CONTROLLER_TYPE_PS4;
|
||||
type = SDL_GAMEPAD_TYPE_PS4;
|
||||
break;
|
||||
case k_eControllerType_PS5Controller:
|
||||
type = SDL_CONTROLLER_TYPE_PS5;
|
||||
type = SDL_GAMEPAD_TYPE_PS5;
|
||||
break;
|
||||
case k_eControllerType_XInputPS4Controller:
|
||||
if (forUI) {
|
||||
type = SDL_CONTROLLER_TYPE_PS4;
|
||||
type = SDL_GAMEPAD_TYPE_PS4;
|
||||
} else {
|
||||
type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
}
|
||||
break;
|
||||
case k_eControllerType_SwitchProController:
|
||||
case k_eControllerType_SwitchInputOnlyController:
|
||||
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO;
|
||||
type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO;
|
||||
break;
|
||||
case k_eControllerType_XInputSwitchController:
|
||||
if (forUI) {
|
||||
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO;
|
||||
type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO;
|
||||
} else {
|
||||
type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -2145,24 +2145,24 @@ SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor
|
||||
return type;
|
||||
}
|
||||
|
||||
SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *name)
|
||||
SDL_GamepadType SDL_GetGamepadTypeFromGUID(SDL_JoystickGUID guid, const char *name)
|
||||
{
|
||||
SDL_GameControllerType type;
|
||||
SDL_GamepadType type;
|
||||
Uint16 vendor, product;
|
||||
|
||||
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL);
|
||||
type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, name, SDL_TRUE);
|
||||
if (type == SDL_CONTROLLER_TYPE_UNKNOWN) {
|
||||
type = SDL_GetGamepadTypeFromVIDPID(vendor, product, name, SDL_TRUE);
|
||||
if (type == SDL_GAMEPAD_TYPE_UNKNOWN) {
|
||||
if (SDL_IsJoystickXInput(guid)) {
|
||||
/* This is probably an Xbox One controller */
|
||||
return SDL_CONTROLLER_TYPE_XBOXONE;
|
||||
return SDL_GAMEPAD_TYPE_XBOXONE;
|
||||
}
|
||||
if (SDL_IsJoystickVIRTUAL(guid)) {
|
||||
return SDL_CONTROLLER_TYPE_VIRTUAL;
|
||||
return SDL_GAMEPAD_TYPE_VIRTUAL;
|
||||
}
|
||||
#ifdef SDL_JOYSTICK_HIDAPI
|
||||
if (SDL_IsJoystickHIDAPI(guid)) {
|
||||
return HIDAPI_GetGameControllerTypeFromGUID(guid);
|
||||
return HIDAPI_GetGamepadTypeFromGUID(guid);
|
||||
}
|
||||
#endif /* SDL_JOYSTICK_HIDAPI */
|
||||
}
|
||||
@ -2674,7 +2674,7 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_ShouldIgnoreGameController(name, guid)) {
|
||||
if (SDL_ShouldIgnoreGamepad(name, guid)) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
@ -2732,7 +2732,7 @@ SDL_JoystickType SDL_GetJoystickDeviceType(int device_index)
|
||||
|
||||
type = SDL_GetJoystickGUIDType(guid);
|
||||
if (type == SDL_JOYSTICK_TYPE_UNKNOWN) {
|
||||
if (SDL_IsGameController(device_index)) {
|
||||
if (SDL_IsGamepad(device_index)) {
|
||||
type = SDL_JOYSTICK_TYPE_GAMECONTROLLER;
|
||||
}
|
||||
}
|
||||
@ -2965,16 +2965,16 @@ int SDL_PrivateJoystickTouchpad(Uint64 timestamp, SDL_Joystick *joystick, int to
|
||||
}
|
||||
|
||||
if (state == finger_info->state) {
|
||||
event_type = SDL_CONTROLLERTOUCHPADMOTION;
|
||||
event_type = SDL_GAMEPADTOUCHPADMOTION;
|
||||
} else if (state) {
|
||||
event_type = SDL_CONTROLLERTOUCHPADDOWN;
|
||||
event_type = SDL_GAMEPADTOUCHPADDOWN;
|
||||
} else {
|
||||
event_type = SDL_CONTROLLERTOUCHPADUP;
|
||||
event_type = SDL_GAMEPADTOUCHPADUP;
|
||||
}
|
||||
|
||||
/* We ignore events if we don't have keyboard focus, except for touch release */
|
||||
if (SDL_PrivateJoystickShouldIgnoreEvent()) {
|
||||
if (event_type != SDL_CONTROLLERTOUCHPADUP) {
|
||||
if (event_type != SDL_GAMEPADTOUCHPADUP) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -3028,9 +3028,9 @@ int SDL_PrivateJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_Sens
|
||||
|
||||
/* Post the event, if desired */
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(SDL_CONTROLLERSENSORUPDATE) == SDL_ENABLE) {
|
||||
if (SDL_GetEventState(SDL_GAMEPADSENSORUPDATE) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_CONTROLLERSENSORUPDATE;
|
||||
event.type = SDL_GAMEPADSENSORUPDATE;
|
||||
event.common.timestamp = timestamp;
|
||||
event.csensor.which = joystick->instance_id;
|
||||
event.csensor.sensor = type;
|
||||
|
@ -53,10 +53,10 @@ extern void SDL_AssertJoysticksLocked(void) SDL_ASSERT_CAPABILITY(SDL_joystick_l
|
||||
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);
|
||||
extern int SDL_GamepadInitMappings(void);
|
||||
extern void SDL_GamepadQuitMappings(void);
|
||||
extern int SDL_GamepadInit(void);
|
||||
extern void SDL_GamepadQuit(void);
|
||||
|
||||
/* Function to return the device index for a joystick ID, or -1 if not found */
|
||||
extern int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id);
|
||||
@ -85,8 +85,8 @@ extern void SDL_SetJoystickGUIDVersion(SDL_JoystickGUID *guid, Uint16 version);
|
||||
extern void SDL_SetJoystickGUIDCRC(SDL_JoystickGUID *guid, Uint16 crc);
|
||||
|
||||
/* Function to return the type of a controller */
|
||||
extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI);
|
||||
extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *name);
|
||||
extern SDL_GamepadType SDL_GetGamepadTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI);
|
||||
extern SDL_GamepadType SDL_GetGamepadTypeFromGUID(SDL_JoystickGUID guid, const char *name);
|
||||
|
||||
/* Function to return whether a joystick is an Xbox One controller */
|
||||
extern SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id);
|
||||
@ -137,14 +137,14 @@ extern SDL_bool SDL_IsJoystickVIRTUAL(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 joystick name and GUID is a gamepad */
|
||||
extern SDL_bool SDL_IsGamepadNameAndGUID(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);
|
||||
/* Function to return whether a gamepad should be ignored */
|
||||
extern SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid);
|
||||
|
||||
/* Handle delayed guide button on a game controller */
|
||||
extern void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick);
|
||||
/* Handle delayed guide button on a gamepad */
|
||||
extern void SDL_GamepadHandleDelayedGuideButton(SDL_Joystick *joystick);
|
||||
|
||||
/* Internal event queueing functions */
|
||||
extern void SDL_PrivateJoystickAddTouchpad(SDL_Joystick *joystick, int nfingers);
|
||||
|
@ -62,7 +62,7 @@ typedef struct _SDL_JoystickSensorInfo
|
||||
SDL_SensorType type;
|
||||
SDL_bool enabled;
|
||||
float rate;
|
||||
float data[3]; /* If this needs to expand, update SDL_ControllerSensorEvent */
|
||||
float data[3]; /* If this needs to expand, update SDL_GamepadSensorEvent */
|
||||
} SDL_JoystickSensorInfo;
|
||||
|
||||
#define _guarded SDL_GUARDED_BY(SDL_joystick_lock)
|
||||
|
@ -73,39 +73,39 @@ static int keycode_to_SDL(int keycode)
|
||||
switch (keycode) {
|
||||
/* Some gamepad buttons (API 9) */
|
||||
case AKEYCODE_BUTTON_A:
|
||||
button = SDL_CONTROLLER_BUTTON_A;
|
||||
button = SDL_GAMEPAD_BUTTON_A;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_B:
|
||||
button = SDL_CONTROLLER_BUTTON_B;
|
||||
button = SDL_GAMEPAD_BUTTON_B;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_X:
|
||||
button = SDL_CONTROLLER_BUTTON_X;
|
||||
button = SDL_GAMEPAD_BUTTON_X;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_Y:
|
||||
button = SDL_CONTROLLER_BUTTON_Y;
|
||||
button = SDL_GAMEPAD_BUTTON_Y;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_L1:
|
||||
button = SDL_CONTROLLER_BUTTON_LEFTSHOULDER;
|
||||
button = SDL_GAMEPAD_BUTTON_LEFT_SHOULDER;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_R1:
|
||||
button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
|
||||
button = SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_THUMBL:
|
||||
button = SDL_CONTROLLER_BUTTON_LEFTSTICK;
|
||||
button = SDL_GAMEPAD_BUTTON_LEFT_STICK;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_THUMBR:
|
||||
button = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
|
||||
button = SDL_GAMEPAD_BUTTON_RIGHT_STICK;
|
||||
break;
|
||||
case AKEYCODE_MENU:
|
||||
case AKEYCODE_BUTTON_START:
|
||||
button = SDL_CONTROLLER_BUTTON_START;
|
||||
button = SDL_GAMEPAD_BUTTON_START;
|
||||
break;
|
||||
case AKEYCODE_BACK:
|
||||
case AKEYCODE_BUTTON_SELECT:
|
||||
button = SDL_CONTROLLER_BUTTON_BACK;
|
||||
button = SDL_GAMEPAD_BUTTON_BACK;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_MODE:
|
||||
button = SDL_CONTROLLER_BUTTON_GUIDE;
|
||||
button = SDL_GAMEPAD_BUTTON_GUIDE;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_L2:
|
||||
button = 15;
|
||||
@ -122,21 +122,21 @@ static int keycode_to_SDL(int keycode)
|
||||
|
||||
/* D-Pad key codes (API 1) */
|
||||
case AKEYCODE_DPAD_UP:
|
||||
button = SDL_CONTROLLER_BUTTON_DPAD_UP;
|
||||
button = SDL_GAMEPAD_BUTTON_DPAD_UP;
|
||||
break;
|
||||
case AKEYCODE_DPAD_DOWN:
|
||||
button = SDL_CONTROLLER_BUTTON_DPAD_DOWN;
|
||||
button = SDL_GAMEPAD_BUTTON_DPAD_DOWN;
|
||||
break;
|
||||
case AKEYCODE_DPAD_LEFT:
|
||||
button = SDL_CONTROLLER_BUTTON_DPAD_LEFT;
|
||||
button = SDL_GAMEPAD_BUTTON_DPAD_LEFT;
|
||||
break;
|
||||
case AKEYCODE_DPAD_RIGHT:
|
||||
button = SDL_CONTROLLER_BUTTON_DPAD_RIGHT;
|
||||
button = SDL_GAMEPAD_BUTTON_DPAD_RIGHT;
|
||||
break;
|
||||
case AKEYCODE_DPAD_CENTER:
|
||||
/* This is handled better by applications as the A button */
|
||||
/*button = 19;*/
|
||||
button = SDL_CONTROLLER_BUTTON_A;
|
||||
button = SDL_GAMEPAD_BUTTON_A;
|
||||
break;
|
||||
|
||||
/* More gamepad buttons (API 12), these get mapped to 20...35*/
|
||||
@ -174,19 +174,19 @@ static int keycode_to_SDL(int keycode)
|
||||
static SDL_Scancode button_to_scancode(int button)
|
||||
{
|
||||
switch (button) {
|
||||
case SDL_CONTROLLER_BUTTON_A:
|
||||
case SDL_GAMEPAD_BUTTON_A:
|
||||
return SDL_SCANCODE_RETURN;
|
||||
case SDL_CONTROLLER_BUTTON_B:
|
||||
case SDL_GAMEPAD_BUTTON_B:
|
||||
return SDL_SCANCODE_ESCAPE;
|
||||
case SDL_CONTROLLER_BUTTON_BACK:
|
||||
case SDL_GAMEPAD_BUTTON_BACK:
|
||||
return SDL_SCANCODE_ESCAPE;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_UP:
|
||||
case SDL_GAMEPAD_BUTTON_DPAD_UP:
|
||||
return SDL_SCANCODE_UP;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
|
||||
case SDL_GAMEPAD_BUTTON_DPAD_DOWN:
|
||||
return SDL_SCANCODE_DOWN;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
|
||||
case SDL_GAMEPAD_BUTTON_DPAD_LEFT:
|
||||
return SDL_SCANCODE_LEFT;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
|
||||
case SDL_GAMEPAD_BUTTON_DPAD_RIGHT:
|
||||
return SDL_SCANCODE_RIGHT;
|
||||
}
|
||||
|
||||
@ -249,10 +249,10 @@ int Android_OnJoy(int device_id, int axis, float value)
|
||||
|
||||
int Android_OnHat(int device_id, int hat_id, int x, int y)
|
||||
{
|
||||
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);
|
||||
const int DPAD_UP_MASK = (1 << SDL_GAMEPAD_BUTTON_DPAD_UP);
|
||||
const int DPAD_DOWN_MASK = (1 << SDL_GAMEPAD_BUTTON_DPAD_DOWN);
|
||||
const int DPAD_LEFT_MASK = (1 << SDL_GAMEPAD_BUTTON_DPAD_LEFT);
|
||||
const int DPAD_RIGHT_MASK = (1 << SDL_GAMEPAD_BUTTON_DPAD_RIGHT);
|
||||
|
||||
if (x >= -1 && x <= 1 && y >= -1 && y <= 1) {
|
||||
SDL_joylist_item *item;
|
||||
@ -276,16 +276,16 @@ int Android_OnHat(int device_id, int hat_id, int x, int y)
|
||||
dpad_delta = (dpad_state ^ item->dpad_state);
|
||||
if (dpad_delta) {
|
||||
if (dpad_delta & DPAD_UP_MASK) {
|
||||
SDL_PrivateJoystickButton(0, item->joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (dpad_state & DPAD_UP_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(0, item->joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, (dpad_state & DPAD_UP_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
if (dpad_delta & DPAD_DOWN_MASK) {
|
||||
SDL_PrivateJoystickButton(0, item->joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (dpad_state & DPAD_DOWN_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(0, item->joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, (dpad_state & DPAD_DOWN_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
if (dpad_delta & DPAD_LEFT_MASK) {
|
||||
SDL_PrivateJoystickButton(0, item->joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (dpad_state & DPAD_LEFT_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(0, item->joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, (dpad_state & DPAD_LEFT_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
if (dpad_delta & DPAD_RIGHT_MASK) {
|
||||
SDL_PrivateJoystickButton(0, item->joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (dpad_state & DPAD_RIGHT_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(0, item->joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, (dpad_state & DPAD_RIGHT_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
item->dpad_state = dpad_state;
|
||||
}
|
||||
@ -335,22 +335,22 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v
|
||||
axis_mask = 0;
|
||||
if (!is_accelerometer) {
|
||||
if (naxes >= 2) {
|
||||
axis_mask |= ((1 << SDL_CONTROLLER_AXIS_LEFTX) | (1 << SDL_CONTROLLER_AXIS_LEFTY));
|
||||
axis_mask |= ((1 << SDL_GAMEPAD_AXIS_LEFTX) | (1 << SDL_GAMEPAD_AXIS_LEFTY));
|
||||
}
|
||||
if (naxes >= 4) {
|
||||
axis_mask |= ((1 << SDL_CONTROLLER_AXIS_RIGHTX) | (1 << SDL_CONTROLLER_AXIS_RIGHTY));
|
||||
axis_mask |= ((1 << SDL_GAMEPAD_AXIS_RIGHTX) | (1 << SDL_GAMEPAD_AXIS_RIGHTY));
|
||||
}
|
||||
if (naxes >= 6) {
|
||||
axis_mask |= ((1 << SDL_CONTROLLER_AXIS_TRIGGERLEFT) | (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT));
|
||||
axis_mask |= ((1 << SDL_GAMEPAD_AXIS_LEFT_TRIGGER) | (1 << SDL_GAMEPAD_AXIS_RIGHT_TRIGGER));
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
button_mask |= ((1 << SDL_GAMEPAD_BUTTON_DPAD_UP) |
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_DOWN) |
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_LEFT) |
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_RIGHT));
|
||||
nhats = 0;
|
||||
}
|
||||
|
||||
|
@ -256,45 +256,45 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
|
||||
BOOL has_direct_menu;
|
||||
|
||||
#ifdef SDL_JOYSTICK_HIDAPI
|
||||
if ((is_xbox && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_XBOXONE)) ||
|
||||
(is_ps4 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS4)) ||
|
||||
(is_ps5 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS5)) ||
|
||||
(is_switch_pro && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO))) {
|
||||
if ((is_xbox && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_XBOXONE)) ||
|
||||
(is_ps4 && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_PS4)) ||
|
||||
(is_ps5 && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_PS5)) ||
|
||||
(is_switch_pro && HIDAPI_IsDeviceTypePresent(SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO))) {
|
||||
/* The HIDAPI driver is taking care of this device */
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* These buttons are part of the original MFi spec */
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_X);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_A);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_B);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_X);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_Y);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_LEFT_SHOULDER);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER);
|
||||
nbuttons += 6;
|
||||
|
||||
/* These buttons are available on some newer controllers */
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
||||
if ([gamepad respondsToSelector:@selector(leftThumbstickButton)] && gamepad.leftThumbstickButton) {
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_LEFT_STICK);
|
||||
++nbuttons;
|
||||
}
|
||||
if ([gamepad respondsToSelector:@selector(rightThumbstickButton)] && gamepad.rightThumbstickButton) {
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_RIGHT_STICK);
|
||||
++nbuttons;
|
||||
}
|
||||
if ([gamepad respondsToSelector:@selector(buttonOptions)] && gamepad.buttonOptions) {
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_BACK);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_BACK);
|
||||
++nbuttons;
|
||||
}
|
||||
/* The Nintendo Switch JoyCon home button doesn't ever show as being held down */
|
||||
if ([gamepad respondsToSelector:@selector(buttonHome)] && gamepad.buttonHome && !is_switch_joycon_pair) {
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_GUIDE);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_GUIDE);
|
||||
++nbuttons;
|
||||
}
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_START);
|
||||
++nbuttons;
|
||||
|
||||
has_direct_menu = [gamepad respondsToSelector:@selector(buttonMenu)] && gamepad.buttonMenu;
|
||||
@ -303,7 +303,7 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
|
||||
}
|
||||
#if TARGET_OS_TV
|
||||
/* The single menu button isn't very reliable, at least as of tvOS 16.1 */
|
||||
if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) == 0) {
|
||||
if ((device->button_mask & (1 << SDL_GAMEPAD_BUTTON_BACK)) == 0) {
|
||||
device->uses_pause_handler = SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
@ -312,32 +312,32 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
|
||||
if ([controller respondsToSelector:@selector(physicalInputProfile)]) {
|
||||
if (controller.physicalInputProfile.buttons[GCInputDualShockTouchpadButton] != nil) {
|
||||
device->has_dualshock_touchpad = SDL_TRUE;
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_MISC1);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_MISC1);
|
||||
++nbuttons;
|
||||
}
|
||||
if (controller.physicalInputProfile.buttons[GCInputXboxPaddleOne] != nil) {
|
||||
device->has_xbox_paddles = SDL_TRUE;
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_PADDLE1);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_PADDLE1);
|
||||
++nbuttons;
|
||||
}
|
||||
if (controller.physicalInputProfile.buttons[GCInputXboxPaddleTwo] != nil) {
|
||||
device->has_xbox_paddles = SDL_TRUE;
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_PADDLE2);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_PADDLE2);
|
||||
++nbuttons;
|
||||
}
|
||||
if (controller.physicalInputProfile.buttons[GCInputXboxPaddleThree] != nil) {
|
||||
device->has_xbox_paddles = SDL_TRUE;
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_PADDLE3);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_PADDLE3);
|
||||
++nbuttons;
|
||||
}
|
||||
if (controller.physicalInputProfile.buttons[GCInputXboxPaddleFour] != nil) {
|
||||
device->has_xbox_paddles = SDL_TRUE;
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_PADDLE4);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_PADDLE4);
|
||||
++nbuttons;
|
||||
}
|
||||
if (controller.physicalInputProfile.buttons[GCInputXboxShareButton] != nil) {
|
||||
device->has_xbox_share_button = SDL_TRUE;
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_MISC1);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_MISC1);
|
||||
++nbuttons;
|
||||
}
|
||||
}
|
||||
@ -388,8 +388,8 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
|
||||
|
||||
if (SDL_strcmp(name, "Backbone One") == 0) {
|
||||
/* The Backbone app uses share button */
|
||||
if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_MISC1)) != 0) {
|
||||
device->button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_MISC1);
|
||||
if ((device->button_mask & (1 << SDL_GAMEPAD_BUTTON_MISC1)) != 0) {
|
||||
device->button_mask &= ~(1 << SDL_GAMEPAD_BUTTON_MISC1);
|
||||
--nbuttons;
|
||||
device->has_xbox_share_button = SDL_FALSE;
|
||||
}
|
||||
@ -419,17 +419,17 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
|
||||
}
|
||||
|
||||
/* These buttons are part of the original MFi spec */
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_X);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_A);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_B);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_X);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_Y);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_LEFT_SHOULDER);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER);
|
||||
#if TARGET_OS_TV
|
||||
/* The menu button is used by the OS and not available to applications */
|
||||
nbuttons += 6;
|
||||
#else
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_START);
|
||||
nbuttons += 7;
|
||||
device->uses_pause_handler = SDL_TRUE;
|
||||
#endif
|
||||
@ -442,11 +442,11 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
|
||||
else if (controller.microGamepad) {
|
||||
int nbuttons = 0;
|
||||
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A);
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); /* Button X on microGamepad */
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_A);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_B); /* Button X on microGamepad */
|
||||
nbuttons += 2;
|
||||
|
||||
device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START);
|
||||
device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_START);
|
||||
++nbuttons;
|
||||
device->uses_pause_handler = SDL_TRUE;
|
||||
|
||||
@ -961,20 +961,20 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
|
||||
/* These buttons are available on some newer controllers */
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_LEFT_STICK)) {
|
||||
buttons[button_count++] = gamepad.leftThumbstickButton.isPressed;
|
||||
}
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_RIGHT_STICK)) {
|
||||
buttons[button_count++] = gamepad.rightThumbstickButton.isPressed;
|
||||
}
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_BACK)) {
|
||||
buttons[button_count++] = gamepad.buttonOptions.isPressed;
|
||||
}
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_GUIDE)) {
|
||||
buttons[button_count++] = gamepad.buttonHome.isPressed;
|
||||
}
|
||||
/* This must be the last button, so we can optionally handle it with pause_button_index below */
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_START)) {
|
||||
if (joystick->hwdata->uses_pause_handler) {
|
||||
pause_button_index = button_count;
|
||||
buttons[button_count++] = joystick->delayed_guide_button;
|
||||
@ -1004,16 +1004,16 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
|
||||
}
|
||||
|
||||
if (joystick->hwdata->has_xbox_paddles) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE1)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_PADDLE1)) {
|
||||
buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputXboxPaddleOne].isPressed;
|
||||
}
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE2)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_PADDLE2)) {
|
||||
buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputXboxPaddleTwo].isPressed;
|
||||
}
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE3)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_PADDLE3)) {
|
||||
buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputXboxPaddleThree].isPressed;
|
||||
}
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE4)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_PADDLE4)) {
|
||||
buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputXboxPaddleFour].isPressed;
|
||||
}
|
||||
|
||||
@ -1117,7 +1117,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
||||
/* This must be the last button, so we can optionally handle it with pause_button_index below */
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) {
|
||||
if (joystick->hwdata->button_mask & (1 << SDL_GAMEPAD_BUTTON_START)) {
|
||||
if (joystick->hwdata->uses_pause_handler) {
|
||||
pause_button_index = button_count;
|
||||
buttons[button_count++] = joystick->delayed_guide_button;
|
||||
@ -1703,50 +1703,50 @@ static GCControllerDirectionPad *GetDirectionalPadForController(GCController *co
|
||||
static char elementName[256];
|
||||
|
||||
const char *
|
||||
IOS_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
|
||||
IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
|
||||
{
|
||||
elementName[0] = '\0';
|
||||
#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
|
||||
if (gamecontroller && SDL_GameControllerGetJoystick(gamecontroller)->driver == &SDL_IOS_JoystickDriver) {
|
||||
if (gamepad && SDL_GetGamepadJoystick(gamepad)->driver == &SDL_IOS_JoystickDriver) {
|
||||
if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
|
||||
GCController *controller = SDL_GameControllerGetJoystick(gamecontroller)->hwdata->controller;
|
||||
GCController *controller = SDL_GetGamepadJoystick(gamepad)->hwdata->controller;
|
||||
if ([controller respondsToSelector:@selector(physicalInputProfile)]) {
|
||||
NSDictionary<NSString *, GCControllerElement *> *elements = controller.physicalInputProfile.elements;
|
||||
switch (button) {
|
||||
case SDL_CONTROLLER_BUTTON_A:
|
||||
case SDL_GAMEPAD_BUTTON_A:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputButtonA], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_B:
|
||||
case SDL_GAMEPAD_BUTTON_B:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputButtonB], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_X:
|
||||
case SDL_GAMEPAD_BUTTON_X:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputButtonX], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_Y:
|
||||
case SDL_GAMEPAD_BUTTON_Y:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputButtonY], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_BACK:
|
||||
case SDL_GAMEPAD_BUTTON_BACK:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputButtonOptions], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_GUIDE:
|
||||
case SDL_GAMEPAD_BUTTON_GUIDE:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputButtonHome], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_START:
|
||||
case SDL_GAMEPAD_BUTTON_START:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputButtonMenu], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_LEFTSTICK:
|
||||
case SDL_GAMEPAD_BUTTON_LEFT_STICK:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstickButton], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_RIGHTSTICK:
|
||||
case SDL_GAMEPAD_BUTTON_RIGHT_STICK:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstickButton], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_LEFTSHOULDER:
|
||||
case SDL_GAMEPAD_BUTTON_LEFT_SHOULDER:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputLeftShoulder], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER:
|
||||
case SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputRightShoulder], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_UP:
|
||||
case SDL_GAMEPAD_BUTTON_DPAD_UP:
|
||||
{
|
||||
GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
|
||||
if (dpad) {
|
||||
@ -1757,7 +1757,7 @@ IOS_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontrol
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
|
||||
case SDL_GAMEPAD_BUTTON_DPAD_DOWN:
|
||||
{
|
||||
GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
|
||||
if (dpad) {
|
||||
@ -1768,7 +1768,7 @@ IOS_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontrol
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
|
||||
case SDL_GAMEPAD_BUTTON_DPAD_LEFT:
|
||||
{
|
||||
GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
|
||||
if (dpad) {
|
||||
@ -1779,7 +1779,7 @@ IOS_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontrol
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
|
||||
case SDL_GAMEPAD_BUTTON_DPAD_RIGHT:
|
||||
{
|
||||
GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
|
||||
if (dpad) {
|
||||
@ -1790,22 +1790,22 @@ IOS_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontrol
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_CONTROLLER_BUTTON_MISC1:
|
||||
case SDL_GAMEPAD_BUTTON_MISC1:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_PADDLE1:
|
||||
case SDL_GAMEPAD_BUTTON_PADDLE1:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleOne], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_PADDLE2:
|
||||
case SDL_GAMEPAD_BUTTON_PADDLE2:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleTwo], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_PADDLE3:
|
||||
case SDL_GAMEPAD_BUTTON_PADDLE3:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleThree], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_PADDLE4:
|
||||
case SDL_GAMEPAD_BUTTON_PADDLE4:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleFour], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_TOUCHPAD:
|
||||
case SDL_GAMEPAD_BUTTON_TOUCHPAD:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName);
|
||||
break;
|
||||
default:
|
||||
@ -1819,32 +1819,32 @@ IOS_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontrol
|
||||
}
|
||||
|
||||
const char *
|
||||
IOS_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
|
||||
IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
|
||||
{
|
||||
elementName[0] = '\0';
|
||||
#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
|
||||
if (gamecontroller && SDL_GameControllerGetJoystick(gamecontroller)->driver == &SDL_IOS_JoystickDriver) {
|
||||
if (gamepad && SDL_GetGamepadJoystick(gamepad)->driver == &SDL_IOS_JoystickDriver) {
|
||||
if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
|
||||
GCController *controller = SDL_GameControllerGetJoystick(gamecontroller)->hwdata->controller;
|
||||
GCController *controller = SDL_GetGamepadJoystick(gamepad)->hwdata->controller;
|
||||
if ([controller respondsToSelector:@selector(physicalInputProfile)]) {
|
||||
NSDictionary<NSString *, GCControllerElement *> *elements = controller.physicalInputProfile.elements;
|
||||
switch (axis) {
|
||||
case SDL_CONTROLLER_AXIS_LEFTX:
|
||||
case SDL_GAMEPAD_AXIS_LEFTX:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_LEFTY:
|
||||
case SDL_GAMEPAD_AXIS_LEFTY:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_RIGHTX:
|
||||
case SDL_GAMEPAD_AXIS_RIGHTX:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_RIGHTY:
|
||||
case SDL_GAMEPAD_AXIS_RIGHTY:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
|
||||
case SDL_GAMEPAD_AXIS_LEFT_TRIGGER:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputLeftTrigger], elementName);
|
||||
break;
|
||||
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
|
||||
case SDL_GAMEPAD_AXIS_RIGHT_TRIGGER:
|
||||
GetAppleSFSymbolsNameForElement(elements[GCInputRightTrigger], elementName);
|
||||
break;
|
||||
default:
|
||||
|
@ -10,6 +10,6 @@ cat <<__EOF__
|
||||
__EOF__
|
||||
|
||||
echo "Actual output:"
|
||||
${FGREP:-grep -F} 8BitDo SDL_gamecontrollerdb.h | ${FGREP:-grep -F} -v hint
|
||||
${EGREP:-grep -E} "hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1" SDL_gamecontrollerdb.h | ${FGREP:-grep -F} -i 8bit | ${FGREP:-grep -F} -v x:b2,y:b3 | ${FGREP:-grep -F} -v x:b3,y:b4
|
||||
${EGREP:-grep -E} "hint:.SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1" SDL_gamecontrollerdb.h | ${FGREP:-grep -F} -i 8bit | ${FGREP:-grep -F} -v x:b3,y:b2 | ${FGREP:-grep -F} -v x:b4,y:b3
|
||||
${FGREP:-grep -F} 8BitDo SDL_gamepad_db.h | ${FGREP:-grep -F} -v hint
|
||||
${EGREP:-grep -E} "hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1" SDL_gamepad_db.h | ${FGREP:-grep -F} -i 8bit | ${FGREP:-grep -F} -v x:b2,y:b3 | ${FGREP:-grep -F} -v x:b3,y:b4
|
||||
${EGREP:-grep -E} "hint:.SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1" SDL_gamepad_db.h | ${FGREP:-grep -F} -i 8bit | ${FGREP:-grep -F} -v x:b3,y:b2 | ${FGREP:-grep -F} -v x:b4,y:b3
|
||||
|
@ -39,7 +39,7 @@ static SDL_bool HIDAPI_DriverCombined_IsEnabled(void)
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverCombined_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverCombined_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
/* This is always explicitly created for combined devices */
|
||||
return SDL_FALSE;
|
||||
|
@ -40,8 +40,8 @@ typedef struct
|
||||
SDL_bool pc_mode;
|
||||
SDL_JoystickID joysticks[MAX_CONTROLLERS];
|
||||
Uint8 wireless[MAX_CONTROLLERS];
|
||||
Uint8 min_axis[MAX_CONTROLLERS * SDL_CONTROLLER_AXIS_MAX];
|
||||
Uint8 max_axis[MAX_CONTROLLERS * SDL_CONTROLLER_AXIS_MAX];
|
||||
Uint8 min_axis[MAX_CONTROLLERS * SDL_GAMEPAD_AXIS_MAX];
|
||||
Uint8 max_axis[MAX_CONTROLLERS * SDL_GAMEPAD_AXIS_MAX];
|
||||
Uint8 rumbleAllowed[MAX_CONTROLLERS];
|
||||
Uint8 rumble[1 + MAX_CONTROLLERS];
|
||||
/* Without this variable, hid_write starts to lag a TON */
|
||||
@ -67,7 +67,7 @@ static SDL_bool HIDAPI_DriverGameCube_IsEnabled(void)
|
||||
SDL_HIDAPI_DEFAULT));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverGameCube_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverGameCube_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
if (vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_GAMECUBE_ADAPTER) {
|
||||
/* Nintendo Co., Ltd. Wii U GameCube Controller Adapter */
|
||||
@ -82,12 +82,12 @@ static SDL_bool HIDAPI_DriverGameCube_IsSupportedDevice(SDL_HIDAPI_Device *devic
|
||||
|
||||
static void ResetAxisRange(SDL_DriverGameCube_Context *ctx, int joystick_index)
|
||||
{
|
||||
SDL_memset(&ctx->min_axis[joystick_index * SDL_CONTROLLER_AXIS_MAX], 128 - 88, SDL_CONTROLLER_AXIS_MAX);
|
||||
SDL_memset(&ctx->max_axis[joystick_index * SDL_CONTROLLER_AXIS_MAX], 128 + 88, SDL_CONTROLLER_AXIS_MAX);
|
||||
SDL_memset(&ctx->min_axis[joystick_index * SDL_GAMEPAD_AXIS_MAX], 128 - 88, SDL_GAMEPAD_AXIS_MAX);
|
||||
SDL_memset(&ctx->max_axis[joystick_index * SDL_GAMEPAD_AXIS_MAX], 128 + 88, SDL_GAMEPAD_AXIS_MAX);
|
||||
|
||||
/* Trigger axes may have a higher resting value */
|
||||
ctx->min_axis[joystick_index * SDL_CONTROLLER_AXIS_MAX + SDL_CONTROLLER_AXIS_TRIGGERLEFT] = 40;
|
||||
ctx->min_axis[joystick_index * SDL_CONTROLLER_AXIS_MAX + SDL_CONTROLLER_AXIS_TRIGGERRIGHT] = 40;
|
||||
ctx->min_axis[joystick_index * SDL_GAMEPAD_AXIS_MAX + SDL_GAMEPAD_AXIS_LEFT_TRIGGER] = 40;
|
||||
ctx->min_axis[joystick_index * SDL_GAMEPAD_AXIS_MAX + SDL_GAMEPAD_AXIS_RIGHT_TRIGGER] = 40;
|
||||
}
|
||||
|
||||
static void SDLCALL SDL_GameControllerButtonReportingHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
@ -109,10 +109,10 @@ static Uint8 RemapButton(SDL_DriverGameCube_Context *ctx, Uint8 button)
|
||||
if (!ctx->m_bUseButtonLabels) {
|
||||
/* Use button positions */
|
||||
switch (button) {
|
||||
case SDL_CONTROLLER_BUTTON_B:
|
||||
return SDL_CONTROLLER_BUTTON_X;
|
||||
case SDL_CONTROLLER_BUTTON_X:
|
||||
return SDL_CONTROLLER_BUTTON_B;
|
||||
case SDL_GAMEPAD_BUTTON_B:
|
||||
return SDL_GAMEPAD_BUTTON_X;
|
||||
case SDL_GAMEPAD_BUTTON_X:
|
||||
return SDL_GAMEPAD_BUTTON_B;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -276,21 +276,21 @@ static void HIDAPI_DriverGameCube_HandleJoystickPacket(SDL_HIDAPI_Device *device
|
||||
|
||||
#define READ_AXIS(off, axis, invert) \
|
||||
v = invert ? (0xff - packet[off]) : packet[off]; \
|
||||
if (v < ctx->min_axis[i * SDL_CONTROLLER_AXIS_MAX + axis]) \
|
||||
ctx->min_axis[i * SDL_CONTROLLER_AXIS_MAX + axis] = v; \
|
||||
if (v > ctx->max_axis[i * SDL_CONTROLLER_AXIS_MAX + axis]) \
|
||||
ctx->max_axis[i * SDL_CONTROLLER_AXIS_MAX + axis] = v; \
|
||||
axis_value = (Sint16)HIDAPI_RemapVal(v, ctx->min_axis[i * SDL_CONTROLLER_AXIS_MAX + axis], ctx->max_axis[i * SDL_CONTROLLER_AXIS_MAX + axis], SDL_MIN_SINT16, SDL_MAX_SINT16); \
|
||||
if (v < ctx->min_axis[i * SDL_GAMEPAD_AXIS_MAX + axis]) \
|
||||
ctx->min_axis[i * SDL_GAMEPAD_AXIS_MAX + axis] = v; \
|
||||
if (v > ctx->max_axis[i * SDL_GAMEPAD_AXIS_MAX + axis]) \
|
||||
ctx->max_axis[i * SDL_GAMEPAD_AXIS_MAX + axis] = v; \
|
||||
axis_value = (Sint16)HIDAPI_RemapVal(v, ctx->min_axis[i * SDL_GAMEPAD_AXIS_MAX + axis], ctx->max_axis[i * SDL_GAMEPAD_AXIS_MAX + axis], SDL_MIN_SINT16, SDL_MAX_SINT16); \
|
||||
SDL_PrivateJoystickAxis( \
|
||||
timestamp, \
|
||||
joystick, \
|
||||
axis, axis_value);
|
||||
READ_AXIS(3, SDL_CONTROLLER_AXIS_LEFTX, 0)
|
||||
READ_AXIS(4, SDL_CONTROLLER_AXIS_LEFTY, 0)
|
||||
READ_AXIS(6, SDL_CONTROLLER_AXIS_RIGHTX, 1)
|
||||
READ_AXIS(5, SDL_CONTROLLER_AXIS_RIGHTY, 1)
|
||||
READ_AXIS(7, SDL_CONTROLLER_AXIS_TRIGGERLEFT, 0)
|
||||
READ_AXIS(8, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, 0)
|
||||
READ_AXIS(3, SDL_GAMEPAD_AXIS_LEFTX, 0)
|
||||
READ_AXIS(4, SDL_GAMEPAD_AXIS_LEFTY, 0)
|
||||
READ_AXIS(6, SDL_GAMEPAD_AXIS_RIGHTX, 1)
|
||||
READ_AXIS(5, SDL_GAMEPAD_AXIS_RIGHTY, 1)
|
||||
READ_AXIS(7, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, 0)
|
||||
READ_AXIS(8, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, 0)
|
||||
#undef READ_AXIS
|
||||
}
|
||||
|
||||
@ -358,21 +358,21 @@ static void HIDAPI_DriverGameCube_HandleNintendoPacket(SDL_HIDAPI_Device *device
|
||||
#undef READ_BUTTON
|
||||
|
||||
#define READ_AXIS(off, axis) \
|
||||
if (curSlot[off] < ctx->min_axis[i * SDL_CONTROLLER_AXIS_MAX + axis]) \
|
||||
ctx->min_axis[i * SDL_CONTROLLER_AXIS_MAX + axis] = curSlot[off]; \
|
||||
if (curSlot[off] > ctx->max_axis[i * SDL_CONTROLLER_AXIS_MAX + axis]) \
|
||||
ctx->max_axis[i * SDL_CONTROLLER_AXIS_MAX + axis] = curSlot[off]; \
|
||||
axis_value = (Sint16)HIDAPI_RemapVal(curSlot[off], ctx->min_axis[i * SDL_CONTROLLER_AXIS_MAX + axis], ctx->max_axis[i * SDL_CONTROLLER_AXIS_MAX + axis], SDL_MIN_SINT16, SDL_MAX_SINT16); \
|
||||
if (curSlot[off] < ctx->min_axis[i * SDL_GAMEPAD_AXIS_MAX + axis]) \
|
||||
ctx->min_axis[i * SDL_GAMEPAD_AXIS_MAX + axis] = curSlot[off]; \
|
||||
if (curSlot[off] > ctx->max_axis[i * SDL_GAMEPAD_AXIS_MAX + axis]) \
|
||||
ctx->max_axis[i * SDL_GAMEPAD_AXIS_MAX + axis] = curSlot[off]; \
|
||||
axis_value = (Sint16)HIDAPI_RemapVal(curSlot[off], ctx->min_axis[i * SDL_GAMEPAD_AXIS_MAX + axis], ctx->max_axis[i * SDL_GAMEPAD_AXIS_MAX + axis], SDL_MIN_SINT16, SDL_MAX_SINT16); \
|
||||
SDL_PrivateJoystickAxis( \
|
||||
timestamp, \
|
||||
joystick, \
|
||||
axis, axis_value);
|
||||
READ_AXIS(3, SDL_CONTROLLER_AXIS_LEFTX)
|
||||
READ_AXIS(4, SDL_CONTROLLER_AXIS_LEFTY)
|
||||
READ_AXIS(5, SDL_CONTROLLER_AXIS_RIGHTX)
|
||||
READ_AXIS(6, SDL_CONTROLLER_AXIS_RIGHTY)
|
||||
READ_AXIS(7, SDL_CONTROLLER_AXIS_TRIGGERLEFT)
|
||||
READ_AXIS(8, SDL_CONTROLLER_AXIS_TRIGGERRIGHT)
|
||||
READ_AXIS(3, SDL_GAMEPAD_AXIS_LEFTX)
|
||||
READ_AXIS(4, SDL_GAMEPAD_AXIS_LEFTY)
|
||||
READ_AXIS(5, SDL_GAMEPAD_AXIS_RIGHTX)
|
||||
READ_AXIS(6, SDL_GAMEPAD_AXIS_RIGHTY)
|
||||
READ_AXIS(7, SDL_GAMEPAD_AXIS_LEFT_TRIGGER)
|
||||
READ_AXIS(8, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER)
|
||||
#undef READ_AXIS
|
||||
}
|
||||
}
|
||||
@ -415,7 +415,7 @@ static SDL_bool HIDAPI_DriverGameCube_OpenJoystick(SDL_HIDAPI_Device *device, SD
|
||||
for (i = 0; i < MAX_CONTROLLERS; i += 1) {
|
||||
if (joystick->instance_id == ctx->joysticks[i]) {
|
||||
joystick->nbuttons = 12;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->epowerlevel = ctx->wireless[i] ? SDL_JOYSTICK_POWER_UNKNOWN : SDL_JOYSTICK_POWER_WIRED;
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
@ -62,9 +62,9 @@ static SDL_bool HIDAPI_DriverLuna_IsEnabled(void)
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_LUNA, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverLuna_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverLuna_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
return (type == SDL_CONTROLLER_TYPE_AMAZON_LUNA) ? SDL_TRUE : SDL_FALSE;
|
||||
return (type == SDL_GAMEPAD_TYPE_AMAZON_LUNA) ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverLuna_InitDevice(SDL_HIDAPI_Device *device)
|
||||
@ -78,7 +78,7 @@ static SDL_bool HIDAPI_DriverLuna_InitDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
device->context = ctx;
|
||||
|
||||
device->type = SDL_CONTROLLER_TYPE_AMAZON_LUNA;
|
||||
device->type = SDL_GAMEPAD_TYPE_AMAZON_LUNA;
|
||||
HIDAPI_SetDeviceName(device, "Amazon Luna Controller");
|
||||
|
||||
return HIDAPI_JoystickConnected(device, NULL);
|
||||
@ -103,7 +103,7 @@ static SDL_bool HIDAPI_DriverLuna_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Jo
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
joystick->nbuttons = SDL_CONTROLLER_NUM_LUNA_BUTTONS;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL;
|
||||
|
||||
return SDL_TRUE;
|
||||
@ -170,20 +170,20 @@ static void HIDAPI_DriverLuna_HandleUSBStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
if (ctx->last_state[1] != data[1]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[1] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[1] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[1] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[1] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[1] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[1] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[1] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[1] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[1] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[1] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[1] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[1] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[1] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[1] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
if (ctx->last_state[2] != data[2]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LUNA_MIC, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[2] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[2] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[3] != data[3]) {
|
||||
@ -224,23 +224,23 @@ static void HIDAPI_DriverLuna_HandleUSBStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
|
||||
#define READ_STICK_AXIS(offset) \
|
||||
(data[offset] == 0x7f ? 0 : (Sint16)HIDAPI_RemapVal((float)data[offset], 0x00, 0xff, SDL_MIN_SINT16, SDL_MAX_SINT16))
|
||||
{
|
||||
Sint16 axis = READ_STICK_AXIS(4);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = READ_STICK_AXIS(5);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = READ_STICK_AXIS(6);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = READ_STICK_AXIS(7);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
}
|
||||
#undef READ_STICK_AXIS
|
||||
|
||||
@ -248,9 +248,9 @@ static void HIDAPI_DriverLuna_HandleUSBStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
(Sint16) HIDAPI_RemapVal((float)data[offset], 0x00, 0xff, SDL_MIN_SINT16, SDL_MAX_SINT16)
|
||||
{
|
||||
Sint16 axis = READ_TRIGGER_AXIS(8);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = READ_TRIGGER_AXIS(9);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
}
|
||||
#undef READ_TRIGGER_AXIS
|
||||
|
||||
@ -263,7 +263,7 @@ static void HIDAPI_DriverLuna_HandleBluetoothStatePacket(SDL_Joystick *joystick,
|
||||
|
||||
if (size >= 2 && data[0] == 0x02) {
|
||||
/* Home button has dedicated report */
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[1] & 0x1) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[1] & 0x1) ? SDL_PRESSED : SDL_RELEASED);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -326,27 +326,27 @@ static void HIDAPI_DriverLuna_HandleBluetoothStatePacket(SDL_Joystick *joystick,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
|
||||
if (ctx->last_state[14] != data[14]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[14] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[14] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[14] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[14] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[14] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[14] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[14] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[14] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[14] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[14] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[14] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[14] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
if (ctx->last_state[15] != data[15]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[15] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[15] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[15] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[15] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[15] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[15] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
if (ctx->last_state[16] != data[16]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[16] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[16] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LUNA_MIC, (data[16] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
@ -354,13 +354,13 @@ static void HIDAPI_DriverLuna_HandleBluetoothStatePacket(SDL_Joystick *joystick,
|
||||
(data[offset] == 0x7f ? 0 : (Sint16)HIDAPI_RemapVal((float)data[offset], 0x00, 0xff, SDL_MIN_SINT16, SDL_MAX_SINT16))
|
||||
{
|
||||
Sint16 axis = READ_STICK_AXIS(2);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = READ_STICK_AXIS(4);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = READ_STICK_AXIS(6);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = READ_STICK_AXIS(8);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
}
|
||||
#undef READ_STICK_AXIS
|
||||
|
||||
@ -368,9 +368,9 @@ static void HIDAPI_DriverLuna_HandleBluetoothStatePacket(SDL_Joystick *joystick,
|
||||
(Sint16) HIDAPI_RemapVal((float)((int)(((data[offset] | (data[offset + 1] << 8)) & 0x3ff) - 0x200)), 0x00 - 0x200, 0x3ff - 0x200, SDL_MIN_SINT16, SDL_MAX_SINT16)
|
||||
{
|
||||
Sint16 axis = READ_TRIGGER_AXIS(9);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = READ_TRIGGER_AXIS(11);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
}
|
||||
#undef READ_TRIGGER_AXIS
|
||||
|
||||
|
@ -96,7 +96,7 @@ static SDL_bool HIDAPI_DriverPS3_IsEnabled(void)
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS3, default_value);
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverPS3_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverPS3_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
if (vendor_id == USB_VENDOR_SONY && product_id == USB_PRODUCT_SONY_DS3) {
|
||||
return SDL_TRUE;
|
||||
@ -178,7 +178,7 @@ static SDL_bool HIDAPI_DriverPS3_InitDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
}
|
||||
|
||||
device->type = SDL_CONTROLLER_TYPE_PS3;
|
||||
device->type = SDL_GAMEPAD_TYPE_PS3;
|
||||
HIDAPI_SetDeviceName(device, "PS3 Controller");
|
||||
|
||||
return HIDAPI_JoystickConnected(device, NULL);
|
||||
@ -352,36 +352,36 @@ static void HIDAPI_DriverPS3_HandleMiniStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[4] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[4] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[4] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[4] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[4] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[4] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[4] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[4] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[5] != data[5]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[5] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[5] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, (data[5] & 0x04) ? SDL_JOYSTICK_AXIS_MAX : SDL_JOYSTICK_AXIS_MIN);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, (data[5] & 0x08) ? SDL_JOYSTICK_AXIS_MAX : SDL_JOYSTICK_AXIS_MIN);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[5] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[5] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[5] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[5] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[5] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[5] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, (data[5] & 0x04) ? SDL_JOYSTICK_AXIS_MAX : SDL_JOYSTICK_AXIS_MIN);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, (data[5] & 0x08) ? SDL_JOYSTICK_AXIS_MAX : SDL_JOYSTICK_AXIS_MIN);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[5] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[5] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[5] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[5] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
axis = ((int)data[2] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = ((int)data[3] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = ((int)data[0] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = ((int)data[1] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state)));
|
||||
}
|
||||
@ -392,60 +392,60 @@ static void HIDAPI_DriverPS3_HandleStatePacket(SDL_Joystick *joystick, SDL_Drive
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
if (ctx->last_state[2] != data[2]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[2] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[2] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[3] != data[3]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[3] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[3] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[4] != data[4]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[4] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[4] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
axis = ((int)data[18] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = ((int)data[19] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
axis = ((int)data[6] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = ((int)data[7] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = ((int)data[8] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = ((int)data[9] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
/* Buttons are mapped as axes in the order they appear in the button enumeration */
|
||||
{
|
||||
static int button_axis_offsets[] = {
|
||||
24, /* SDL_CONTROLLER_BUTTON_A */
|
||||
23, /* SDL_CONTROLLER_BUTTON_B */
|
||||
25, /* SDL_CONTROLLER_BUTTON_X */
|
||||
22, /* SDL_CONTROLLER_BUTTON_Y */
|
||||
0, /* SDL_CONTROLLER_BUTTON_BACK */
|
||||
0, /* SDL_CONTROLLER_BUTTON_GUIDE */
|
||||
0, /* SDL_CONTROLLER_BUTTON_START */
|
||||
0, /* SDL_CONTROLLER_BUTTON_LEFTSTICK */
|
||||
0, /* SDL_CONTROLLER_BUTTON_RIGHTSTICK */
|
||||
20, /* SDL_CONTROLLER_BUTTON_LEFTSHOULDER */
|
||||
21, /* SDL_CONTROLLER_BUTTON_RIGHTSHOULDER */
|
||||
14, /* SDL_CONTROLLER_BUTTON_DPAD_UP */
|
||||
16, /* SDL_CONTROLLER_BUTTON_DPAD_DOWN */
|
||||
17, /* SDL_CONTROLLER_BUTTON_DPAD_LEFT */
|
||||
15, /* SDL_CONTROLLER_BUTTON_DPAD_RIGHT */
|
||||
24, /* SDL_GAMEPAD_BUTTON_A */
|
||||
23, /* SDL_GAMEPAD_BUTTON_B */
|
||||
25, /* SDL_GAMEPAD_BUTTON_X */
|
||||
22, /* SDL_GAMEPAD_BUTTON_Y */
|
||||
0, /* SDL_GAMEPAD_BUTTON_BACK */
|
||||
0, /* SDL_GAMEPAD_BUTTON_GUIDE */
|
||||
0, /* SDL_GAMEPAD_BUTTON_START */
|
||||
0, /* SDL_GAMEPAD_BUTTON_LEFT_STICK */
|
||||
0, /* SDL_GAMEPAD_BUTTON_RIGHT_STICK */
|
||||
20, /* SDL_GAMEPAD_BUTTON_LEFT_SHOULDER */
|
||||
21, /* SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER */
|
||||
14, /* SDL_GAMEPAD_BUTTON_DPAD_UP */
|
||||
16, /* SDL_GAMEPAD_BUTTON_DPAD_DOWN */
|
||||
17, /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */
|
||||
15, /* SDL_GAMEPAD_BUTTON_DPAD_RIGHT */
|
||||
};
|
||||
int i, axis_index = 6;
|
||||
|
||||
@ -576,7 +576,7 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_IsEnabled(void)
|
||||
SDL_HIDAPI_DEFAULT));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverPS3ThirdParty_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverPS3ThirdParty_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
Uint8 data[USB_PACKET_LENGTH];
|
||||
int size;
|
||||
@ -611,7 +611,7 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_InitDevice(SDL_HIDAPI_Device *device)
|
||||
|
||||
device->context = ctx;
|
||||
|
||||
device->type = SDL_CONTROLLER_TYPE_PS3;
|
||||
device->type = SDL_GAMEPAD_TYPE_PS3;
|
||||
|
||||
return HIDAPI_JoystickConnected(device, NULL);
|
||||
}
|
||||
@ -678,20 +678,20 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket(SDL_Joystick *joystick,
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
if (ctx->last_state[0] != data[0]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[0] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[0] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[0] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[0] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[0] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[0] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[0] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[0] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[0] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[0] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[0] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[0] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[1] != data[1]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[1] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[1] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[1] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[1] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[1] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[1] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[1] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[1] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[2] != data[2]) {
|
||||
@ -732,43 +732,43 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket(SDL_Joystick *joystick,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
|
||||
axis = ((int)data[17] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = ((int)data[18] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
axis = ((int)data[3] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = ((int)data[4] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = ((int)data[5] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = ((int)data[6] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
/* Buttons are mapped as axes in the order they appear in the button enumeration */
|
||||
{
|
||||
static int button_axis_offsets[] = {
|
||||
13, /* SDL_CONTROLLER_BUTTON_A */
|
||||
12, /* SDL_CONTROLLER_BUTTON_B */
|
||||
14, /* SDL_CONTROLLER_BUTTON_X */
|
||||
11, /* SDL_CONTROLLER_BUTTON_Y */
|
||||
0, /* SDL_CONTROLLER_BUTTON_BACK */
|
||||
0, /* SDL_CONTROLLER_BUTTON_GUIDE */
|
||||
0, /* SDL_CONTROLLER_BUTTON_START */
|
||||
0, /* SDL_CONTROLLER_BUTTON_LEFTSTICK */
|
||||
0, /* SDL_CONTROLLER_BUTTON_RIGHTSTICK */
|
||||
15, /* SDL_CONTROLLER_BUTTON_LEFTSHOULDER */
|
||||
16, /* SDL_CONTROLLER_BUTTON_RIGHTSHOULDER */
|
||||
9, /* SDL_CONTROLLER_BUTTON_DPAD_UP */
|
||||
10, /* SDL_CONTROLLER_BUTTON_DPAD_DOWN */
|
||||
8, /* SDL_CONTROLLER_BUTTON_DPAD_LEFT */
|
||||
7, /* SDL_CONTROLLER_BUTTON_DPAD_RIGHT */
|
||||
13, /* SDL_GAMEPAD_BUTTON_A */
|
||||
12, /* SDL_GAMEPAD_BUTTON_B */
|
||||
14, /* SDL_GAMEPAD_BUTTON_X */
|
||||
11, /* SDL_GAMEPAD_BUTTON_Y */
|
||||
0, /* SDL_GAMEPAD_BUTTON_BACK */
|
||||
0, /* SDL_GAMEPAD_BUTTON_GUIDE */
|
||||
0, /* SDL_GAMEPAD_BUTTON_START */
|
||||
0, /* SDL_GAMEPAD_BUTTON_LEFT_STICK */
|
||||
0, /* SDL_GAMEPAD_BUTTON_RIGHT_STICK */
|
||||
15, /* SDL_GAMEPAD_BUTTON_LEFT_SHOULDER */
|
||||
16, /* SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER */
|
||||
9, /* SDL_GAMEPAD_BUTTON_DPAD_UP */
|
||||
10, /* SDL_GAMEPAD_BUTTON_DPAD_DOWN */
|
||||
8, /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */
|
||||
7, /* SDL_GAMEPAD_BUTTON_DPAD_RIGHT */
|
||||
};
|
||||
int i, axis_index = 6;
|
||||
|
||||
|
@ -174,12 +174,12 @@ static int ReadFeatureReport(SDL_hid_device *dev, Uint8 report_id, Uint8 *report
|
||||
return SDL_hid_get_feature_report(dev, report, length);
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverPS4_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverPS4_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
Uint8 data[USB_PACKET_LENGTH];
|
||||
int size;
|
||||
|
||||
if (type == SDL_CONTROLLER_TYPE_PS4) {
|
||||
if (type == SDL_GAMEPAD_TYPE_PS4) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
@ -384,7 +384,7 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
|
||||
device->joystick_type = joystick_type;
|
||||
device->type = SDL_CONTROLLER_TYPE_PS4;
|
||||
device->type = SDL_GAMEPAD_TYPE_PS4;
|
||||
if (ctx->official_controller) {
|
||||
HIDAPI_SetDeviceName(device, "PS4 Controller");
|
||||
}
|
||||
@ -680,7 +680,7 @@ static SDL_bool HIDAPI_DriverPS4_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joy
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
joystick->nbuttons = ctx->touchpad_supported ? 16 : 15;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
if (device->is_bluetooth && ctx->official_controller) {
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN;
|
||||
} else if (device->is_bluetooth) {
|
||||
@ -830,10 +830,10 @@ static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d
|
||||
{
|
||||
Uint8 data = (packet->rgucButtonsHatAndCounter[0] >> 4);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
{
|
||||
Uint8 data = (packet->rgucButtonsHatAndCounter[0] & 0x0F);
|
||||
@ -874,22 +874,22 @@ static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->last_state.rgucButtonsHatAndCounter[1] != packet->rgucButtonsHatAndCounter[1]) {
|
||||
Uint8 data = packet->rgucButtonsHatAndCounter[1];
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
/* Some fightsticks, ex: Victrix FS Pro will only this these digital trigger bits and not the analog values so this needs to run whenever the
|
||||
@ -904,22 +904,22 @@ static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d
|
||||
if (ctx->last_state.rgucButtonsHatAndCounter[2] != packet->rgucButtonsHatAndCounter[2]) {
|
||||
Uint8 data = (packet->rgucButtonsHatAndCounter[2] & 0x03);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, 15, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
axis = ((int)packet->ucTriggerLeft * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = ((int)packet->ucTriggerRight * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
axis = ((int)packet->ucLeftJoystickX * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = ((int)packet->ucLeftJoystickY * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = ((int)packet->ucRightJoystickX * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = ((int)packet->ucRightJoystickY * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
if (ctx->device->is_bluetooth && ctx->official_controller) {
|
||||
if (packet->ucBatteryLevel & 0x10) {
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
enum
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_PS5_TOUCHPAD = SDL_CONTROLLER_BUTTON_MISC1 + 1,
|
||||
SDL_CONTROLLER_BUTTON_PS5_TOUCHPAD = SDL_GAMEPAD_BUTTON_MISC1 + 1,
|
||||
SDL_CONTROLLER_BUTTON_PS5_LEFT_FUNCTION,
|
||||
SDL_CONTROLLER_BUTTON_PS5_RIGHT_FUNCTION,
|
||||
SDL_CONTROLLER_BUTTON_PS5_LEFT_PADDLE,
|
||||
@ -269,12 +269,12 @@ static int ReadFeatureReport(SDL_hid_device *dev, Uint8 report_id, Uint8 *report
|
||||
return SDL_hid_get_feature_report(dev, report, length);
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverPS5_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverPS5_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
Uint8 data[USB_PACKET_LENGTH];
|
||||
int size;
|
||||
|
||||
if (type == SDL_CONTROLLER_TYPE_PS5) {
|
||||
if (type == SDL_GAMEPAD_TYPE_PS5) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ static SDL_bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
|
||||
ctx->effects_supported = (ctx->lightbar_supported || ctx->vibration_supported || ctx->playerled_supported);
|
||||
|
||||
device->joystick_type = joystick_type;
|
||||
device->type = SDL_CONTROLLER_TYPE_PS5;
|
||||
device->type = SDL_GAMEPAD_TYPE_PS5;
|
||||
if (device->vendor_id == USB_VENDOR_SONY) {
|
||||
if (SDL_IsJoystickDualSenseEdge(device->vendor_id, device->product_id)) {
|
||||
HIDAPI_SetDeviceName(device, "DualSense Edge Wireless Controller");
|
||||
@ -842,7 +842,7 @@ static SDL_bool HIDAPI_DriverPS5_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joy
|
||||
} else {
|
||||
joystick->nbuttons = 15;
|
||||
}
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->epowerlevel = device->is_bluetooth ? SDL_JOYSTICK_POWER_UNKNOWN : SDL_JOYSTICK_POWER_WIRED;
|
||||
joystick->firmware_version = ctx->firmware_version;
|
||||
|
||||
@ -1009,10 +1009,10 @@ static void HIDAPI_DriverPS5_HandleSimpleStatePacket(SDL_Joystick *joystick, SDL
|
||||
{
|
||||
Uint8 data = (packet->rgucButtonsHatAndCounter[0] >> 4);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
{
|
||||
Uint8 data = (packet->rgucButtonsHatAndCounter[0] & 0x0F);
|
||||
@ -1053,43 +1053,43 @@ static void HIDAPI_DriverPS5_HandleSimpleStatePacket(SDL_Joystick *joystick, SDL
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->last_state.simple.rgucButtonsHatAndCounter[1] != packet->rgucButtonsHatAndCounter[1]) {
|
||||
Uint8 data = packet->rgucButtonsHatAndCounter[1];
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state.simple.rgucButtonsHatAndCounter[2] != packet->rgucButtonsHatAndCounter[2]) {
|
||||
Uint8 data = (packet->rgucButtonsHatAndCounter[2] & 0x03);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
axis = ((int)packet->ucTriggerLeft * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = ((int)packet->ucTriggerRight * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
axis = ((int)packet->ucLeftJoystickX * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = ((int)packet->ucLeftJoystickY * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = ((int)packet->ucRightJoystickX * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = ((int)packet->ucRightJoystickY * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
SDL_memcpy(&ctx->last_state.simple, packet, sizeof(ctx->last_state.simple));
|
||||
}
|
||||
@ -1103,10 +1103,10 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
|
||||
{
|
||||
Uint8 data = (packet->rgucButtonsAndHat[0] >> 4);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
{
|
||||
Uint8 data = (packet->rgucButtonsAndHat[0] & 0x0F);
|
||||
@ -1147,29 +1147,29 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->last_state.state.rgucButtonsAndHat[1] != packet->rgucButtonsAndHat[1]) {
|
||||
Uint8 data = packet->rgucButtonsAndHat[1];
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state.state.rgucButtonsAndHat[2] != packet->rgucButtonsAndHat[2]) {
|
||||
Uint8 data = packet->rgucButtonsAndHat[2];
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PS5_TOUCHPAD, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PS5_LEFT_FUNCTION, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PS5_RIGHT_FUNCTION, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
@ -1178,17 +1178,17 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
|
||||
}
|
||||
|
||||
axis = ((int)packet->ucTriggerLeft * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = ((int)packet->ucTriggerRight * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
axis = ((int)packet->ucLeftJoystickX * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = ((int)packet->ucLeftJoystickY * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = ((int)packet->ucRightJoystickX * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = ((int)packet->ucRightJoystickY * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
if (ctx->report_sensors) {
|
||||
Uint32 tick;
|
||||
|
@ -46,12 +46,12 @@
|
||||
|
||||
enum
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_SHIELD_V103_TOUCHPAD = SDL_CONTROLLER_BUTTON_MISC1 + 1,
|
||||
SDL_CONTROLLER_BUTTON_SHIELD_V103_TOUCHPAD = SDL_GAMEPAD_BUTTON_MISC1 + 1,
|
||||
SDL_CONTROLLER_BUTTON_SHIELD_V103_MINUS,
|
||||
SDL_CONTROLLER_BUTTON_SHIELD_V103_PLUS,
|
||||
SDL_CONTROLLER_NUM_SHIELD_V103_BUTTONS,
|
||||
|
||||
SDL_CONTROLLER_NUM_SHIELD_V104_BUTTONS = SDL_CONTROLLER_BUTTON_MISC1 + 1,
|
||||
SDL_CONTROLLER_NUM_SHIELD_V104_BUTTONS = SDL_GAMEPAD_BUTTON_MISC1 + 1,
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@ -104,9 +104,9 @@ static SDL_bool HIDAPI_DriverShield_IsEnabled(void)
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SHIELD, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverShield_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverShield_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
return (type == SDL_CONTROLLER_TYPE_NVIDIA_SHIELD) ? SDL_TRUE : SDL_FALSE;
|
||||
return (type == SDL_GAMEPAD_TYPE_NVIDIA_SHIELD) ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverShield_InitDevice(SDL_HIDAPI_Device *device)
|
||||
@ -120,7 +120,7 @@ static SDL_bool HIDAPI_DriverShield_InitDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
device->context = ctx;
|
||||
|
||||
device->type = SDL_CONTROLLER_TYPE_NVIDIA_SHIELD;
|
||||
device->type = SDL_GAMEPAD_TYPE_NVIDIA_SHIELD;
|
||||
HIDAPI_SetDeviceName(device, "NVIDIA SHIELD Controller");
|
||||
|
||||
return HIDAPI_JoystickConnected(device, NULL);
|
||||
@ -183,13 +183,13 @@ static SDL_bool HIDAPI_DriverShield_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
|
||||
/* Initialize the joystick capabilities */
|
||||
if (device->product_id == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V103) {
|
||||
joystick->nbuttons = SDL_CONTROLLER_NUM_SHIELD_V103_BUTTONS;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;
|
||||
|
||||
SDL_PrivateJoystickAddTouchpad(joystick, 1);
|
||||
} else {
|
||||
joystick->nbuttons = SDL_CONTROLLER_NUM_SHIELD_V104_BUTTONS;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN;
|
||||
}
|
||||
|
||||
@ -327,40 +327,40 @@ static void HIDAPI_DriverShield_HandleStatePacketV103(SDL_Joystick *joystick, SD
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
|
||||
if (ctx->last_state[1] != data[1]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[1] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[1] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[1] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[1] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[1] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[1] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[1] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[1] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[1] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[1] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[1] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[1] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[1] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[1] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[2] != data[2]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_SHIELD_V103_PLUS, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_SHIELD_V103_MINUS, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, SDL_SwapLE16(*(Sint16 *)&data[4]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, SDL_SwapLE16(*(Sint16 *)&data[6]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, SDL_SwapLE16(*(Sint16 *)&data[4]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, SDL_SwapLE16(*(Sint16 *)&data[6]) - 0x8000);
|
||||
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, SDL_SwapLE16(*(Sint16 *)&data[8]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, SDL_SwapLE16(*(Sint16 *)&data[10]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, SDL_SwapLE16(*(Sint16 *)&data[8]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, SDL_SwapLE16(*(Sint16 *)&data[10]) - 0x8000);
|
||||
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, SDL_SwapLE16(*(Sint16 *)&data[12]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, SDL_SwapLE16(*(Sint16 *)&data[14]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, SDL_SwapLE16(*(Sint16 *)&data[12]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, SDL_SwapLE16(*(Sint16 *)&data[14]) - 0x8000);
|
||||
|
||||
SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state)));
|
||||
}
|
||||
@ -429,40 +429,40 @@ static void HIDAPI_DriverShield_HandleStatePacketV104(SDL_Joystick *joystick, SD
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
|
||||
if (ctx->last_state[3] != data[3]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[3] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[3] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[4] != data[4]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[4] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[4] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, SDL_SwapLE16(*(Sint16 *)&data[9]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, SDL_SwapLE16(*(Sint16 *)&data[11]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, SDL_SwapLE16(*(Sint16 *)&data[9]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, SDL_SwapLE16(*(Sint16 *)&data[11]) - 0x8000);
|
||||
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, SDL_SwapLE16(*(Sint16 *)&data[13]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, SDL_SwapLE16(*(Sint16 *)&data[15]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, SDL_SwapLE16(*(Sint16 *)&data[13]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, SDL_SwapLE16(*(Sint16 *)&data[15]) - 0x8000);
|
||||
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, SDL_SwapLE16(*(Sint16 *)&data[19]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, SDL_SwapLE16(*(Sint16 *)&data[21]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, SDL_SwapLE16(*(Sint16 *)&data[19]) - 0x8000);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, SDL_SwapLE16(*(Sint16 *)&data[21]) - 0x8000);
|
||||
|
||||
if (ctx->last_state[17] != data[17]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[17] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[17] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[17] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data[17] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[17] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[17] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state)));
|
||||
|
@ -58,9 +58,9 @@ static SDL_bool HIDAPI_DriverStadia_IsEnabled(void)
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STADIA, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverStadia_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverStadia_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
return (type == SDL_CONTROLLER_TYPE_GOOGLE_STADIA) ? SDL_TRUE : SDL_FALSE;
|
||||
return (type == SDL_GAMEPAD_TYPE_GOOGLE_STADIA) ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverStadia_InitDevice(SDL_HIDAPI_Device *device)
|
||||
@ -74,7 +74,7 @@ static SDL_bool HIDAPI_DriverStadia_InitDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
device->context = ctx;
|
||||
|
||||
device->type = SDL_CONTROLLER_TYPE_GOOGLE_STADIA;
|
||||
device->type = SDL_GAMEPAD_TYPE_GOOGLE_STADIA;
|
||||
HIDAPI_SetDeviceName(device, "Google Stadia Controller");
|
||||
|
||||
return HIDAPI_JoystickConnected(device, NULL);
|
||||
@ -99,7 +99,7 @@ static SDL_bool HIDAPI_DriverStadia_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
joystick->nbuttons = SDL_CONTROLLER_NUM_STADIA_BUTTONS;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;
|
||||
|
||||
return SDL_TRUE;
|
||||
@ -194,42 +194,42 @@ static void HIDAPI_DriverStadia_HandleStatePacket(SDL_Joystick *joystick, SDL_Dr
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
|
||||
if (ctx->last_state[2] != data[2]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_STADIA_SHARE, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_STADIA_GOOGLE_ASSISTANT, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[3] != data[3]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[3] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[3] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
#define READ_STICK_AXIS(offset) \
|
||||
(data[offset] == 0x80 ? 0 : (Sint16)HIDAPI_RemapVal((float)((int)data[offset] - 0x80), 0x01 - 0x80, 0xff - 0x80, SDL_MIN_SINT16, SDL_MAX_SINT16))
|
||||
{
|
||||
axis = READ_STICK_AXIS(4);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = READ_STICK_AXIS(5);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = READ_STICK_AXIS(6);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = READ_STICK_AXIS(7);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
}
|
||||
#undef READ_STICK_AXIS
|
||||
|
||||
@ -237,9 +237,9 @@ static void HIDAPI_DriverStadia_HandleStatePacket(SDL_Joystick *joystick, SDL_Dr
|
||||
(Sint16)(((int)data[offset] * 257) - 32768)
|
||||
{
|
||||
axis = READ_TRIGGER_AXIS(8);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = READ_TRIGGER_AXIS(9);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
}
|
||||
#undef READ_TRIGGER_AXIS
|
||||
|
||||
|
@ -965,7 +965,7 @@ static SDL_bool HIDAPI_DriverSteam_IsEnabled(void)
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STEAM, SDL_FALSE);
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverSteam_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverSteam_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
return SDL_IsJoystickSteamController(vendor_id, product_id);
|
||||
}
|
||||
@ -1027,7 +1027,7 @@ static SDL_bool HIDAPI_DriverSteam_OpenJoystick(SDL_HIDAPI_Device *device, SDL_J
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
joystick->nbuttons = 17;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
|
||||
SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, update_rate_in_hz);
|
||||
SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, update_rate_in_hz);
|
||||
@ -1122,38 +1122,38 @@ static SDL_bool HIDAPI_DriverSteam_UpdateDevice(SDL_HIDAPI_Device *device)
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
if (ctx->m_state.ulButtons != ctx->m_last_state.ulButtons) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A,
|
||||
(ctx->m_state.ulButtons & STEAM_BUTTON_3_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B,
|
||||
(ctx->m_state.ulButtons & STEAM_BUTTON_1_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X,
|
||||
(ctx->m_state.ulButtons & STEAM_BUTTON_2_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y,
|
||||
(ctx->m_state.ulButtons & STEAM_BUTTON_0_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER,
|
||||
(ctx->m_state.ulButtons & STEAM_LEFT_BUMPER_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER,
|
||||
(ctx->m_state.ulButtons & STEAM_RIGHT_BUMPER_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK,
|
||||
(ctx->m_state.ulButtons & STEAM_BUTTON_MENU_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START,
|
||||
(ctx->m_state.ulButtons & STEAM_BUTTON_ESCAPE_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE,
|
||||
(ctx->m_state.ulButtons & STEAM_BUTTON_STEAM_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK,
|
||||
(ctx->m_state.ulButtons & STEAM_JOYSTICK_BUTTON_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1 + 0,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1 + 0,
|
||||
(ctx->m_state.ulButtons & STEAM_BUTTON_BACK_LEFT_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1 + 1,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1 + 1,
|
||||
(ctx->m_state.ulButtons & STEAM_BUTTON_BACK_RIGHT_MASK) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
{
|
||||
@ -1161,26 +1161,26 @@ static SDL_bool HIDAPI_DriverSteam_UpdateDevice(SDL_HIDAPI_Device *device)
|
||||
const int kPadDeadZone = 10000;
|
||||
|
||||
/* Pad coordinates are like math grid coordinates: negative is bottom left */
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP,
|
||||
(ctx->m_state.sLeftPadY > kPadDeadZone) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN,
|
||||
(ctx->m_state.sLeftPadY < -kPadDeadZone) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT,
|
||||
(ctx->m_state.sLeftPadX < -kPadDeadZone) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT,
|
||||
(ctx->m_state.sLeftPadX > kPadDeadZone) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, (int)ctx->m_state.sTriggerL * 2 - 32768);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, (int)ctx->m_state.sTriggerR * 2 - 32768);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, (int)ctx->m_state.sTriggerL * 2 - 32768);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, (int)ctx->m_state.sTriggerR * 2 - 32768);
|
||||
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, ctx->m_state.sLeftStickX);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, ~ctx->m_state.sLeftStickY);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, ctx->m_state.sRightPadX);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~ctx->m_state.sRightPadY);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, ctx->m_state.sLeftStickX);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, ~ctx->m_state.sLeftStickY);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, ctx->m_state.sRightPadX);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, ~ctx->m_state.sRightPadY);
|
||||
|
||||
if (ctx->report_sensors) {
|
||||
float values[3];
|
||||
|
@ -880,23 +880,23 @@ static Uint8 RemapButton(SDL_DriverSwitch_Context *ctx, Uint8 button)
|
||||
/* Use button positions */
|
||||
if (ctx->m_bIsGameCube) {
|
||||
switch (button) {
|
||||
case SDL_CONTROLLER_BUTTON_B:
|
||||
return SDL_CONTROLLER_BUTTON_X;
|
||||
case SDL_CONTROLLER_BUTTON_X:
|
||||
return SDL_CONTROLLER_BUTTON_B;
|
||||
case SDL_GAMEPAD_BUTTON_B:
|
||||
return SDL_GAMEPAD_BUTTON_X;
|
||||
case SDL_GAMEPAD_BUTTON_X:
|
||||
return SDL_GAMEPAD_BUTTON_B;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (button) {
|
||||
case SDL_CONTROLLER_BUTTON_A:
|
||||
return SDL_CONTROLLER_BUTTON_B;
|
||||
case SDL_CONTROLLER_BUTTON_B:
|
||||
return SDL_CONTROLLER_BUTTON_A;
|
||||
case SDL_CONTROLLER_BUTTON_X:
|
||||
return SDL_CONTROLLER_BUTTON_Y;
|
||||
case SDL_CONTROLLER_BUTTON_Y:
|
||||
return SDL_CONTROLLER_BUTTON_X;
|
||||
case SDL_GAMEPAD_BUTTON_A:
|
||||
return SDL_GAMEPAD_BUTTON_B;
|
||||
case SDL_GAMEPAD_BUTTON_B:
|
||||
return SDL_GAMEPAD_BUTTON_A;
|
||||
case SDL_GAMEPAD_BUTTON_X:
|
||||
return SDL_GAMEPAD_BUTTON_Y;
|
||||
case SDL_GAMEPAD_BUTTON_Y:
|
||||
return SDL_GAMEPAD_BUTTON_X;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1025,7 +1025,7 @@ static SDL_bool HIDAPI_DriverNintendoClassic_IsEnabled(void)
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverNintendoClassic_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverNintendoClassic_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
if (vendor_id == USB_VENDOR_NINTENDO) {
|
||||
if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT) {
|
||||
@ -1065,7 +1065,7 @@ static SDL_bool HIDAPI_DriverJoyCons_IsEnabled(void)
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverJoyCons_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverJoyCons_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
if (vendor_id == USB_VENDOR_NINTENDO) {
|
||||
if (product_id == USB_PRODUCT_NINTENDO_SWITCH_PRO && device && device->dev) {
|
||||
@ -1101,7 +1101,7 @@ static SDL_bool HIDAPI_DriverSwitch_IsEnabled(void)
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverSwitch_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverSwitch_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
/* The HORI Wireless Switch Pad enumerates as a HID device when connected via USB
|
||||
with the same VID/PID as when connected over Bluetooth but doesn't actually
|
||||
@ -1119,7 +1119,7 @@ static SDL_bool HIDAPI_DriverSwitch_IsSupportedDevice(SDL_HIDAPI_Device *device,
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
return (type == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO) ? SDL_TRUE : SDL_FALSE;
|
||||
return (type == SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO) ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
static void UpdateDeviceIdentity(SDL_HIDAPI_Device *device)
|
||||
@ -1131,40 +1131,40 @@ static void UpdateDeviceIdentity(SDL_HIDAPI_Device *device)
|
||||
case k_eSwitchDeviceInfoControllerType_JoyConLeft:
|
||||
HIDAPI_SetDeviceName(device, "Nintendo Switch Joy-Con (L)");
|
||||
HIDAPI_SetDeviceProduct(device, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT);
|
||||
device->type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
|
||||
device->type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
|
||||
break;
|
||||
case k_eSwitchDeviceInfoControllerType_JoyConRight:
|
||||
HIDAPI_SetDeviceName(device, "Nintendo Switch Joy-Con (R)");
|
||||
HIDAPI_SetDeviceProduct(device, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT);
|
||||
device->type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
|
||||
device->type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
|
||||
break;
|
||||
case k_eSwitchDeviceInfoControllerType_ProController:
|
||||
HIDAPI_SetDeviceName(device, "Nintendo Switch Pro Controller");
|
||||
HIDAPI_SetDeviceProduct(device, USB_PRODUCT_NINTENDO_SWITCH_PRO);
|
||||
device->type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO;
|
||||
device->type = SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO;
|
||||
break;
|
||||
case k_eSwitchDeviceInfoControllerType_NESLeft:
|
||||
HIDAPI_SetDeviceName(device, "Nintendo NES Controller (L)");
|
||||
device->type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
device->type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
break;
|
||||
case k_eSwitchDeviceInfoControllerType_NESRight:
|
||||
HIDAPI_SetDeviceName(device, "Nintendo NES Controller (R)");
|
||||
device->type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
device->type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
break;
|
||||
case k_eSwitchDeviceInfoControllerType_SNES:
|
||||
HIDAPI_SetDeviceName(device, "Nintendo SNES Controller");
|
||||
HIDAPI_SetDeviceProduct(device, USB_PRODUCT_NINTENDO_SNES_CONTROLLER);
|
||||
device->type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
device->type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
break;
|
||||
case k_eSwitchDeviceInfoControllerType_N64:
|
||||
HIDAPI_SetDeviceName(device, "Nintendo N64 Controller");
|
||||
HIDAPI_SetDeviceProduct(device, USB_PRODUCT_NINTENDO_N64_CONTROLLER);
|
||||
device->type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
device->type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
break;
|
||||
case k_eSwitchDeviceInfoControllerType_SEGA_Genesis:
|
||||
HIDAPI_SetDeviceName(device, "Nintendo SEGA Genesis Controller");
|
||||
HIDAPI_SetDeviceProduct(device, USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER);
|
||||
device->type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
device->type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1365,7 +1365,7 @@ static SDL_bool HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
joystick->nbuttons = 20;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->epowerlevel = device->is_bluetooth ? SDL_JOYSTICK_POWER_UNKNOWN : SDL_JOYSTICK_POWER_WIRED;
|
||||
|
||||
/* Set up for input */
|
||||
@ -1534,28 +1534,28 @@ static void HandleInputOnlyControllerState(SDL_Joystick *joystick, SDL_DriverSwi
|
||||
|
||||
if (packet->rgucButtons[0] != ctx->m_lastInputOnlyState.rgucButtons[0]) {
|
||||
Uint8 data = packet->rgucButtons[0];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_A), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_B), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_X), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
axis = (data & 0x40) ? 32767 : -32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
|
||||
axis = (data & 0x80) ? 32767 : -32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
}
|
||||
|
||||
if (packet->rgucButtons[1] != ctx->m_lastInputOnlyState.rgucButtons[1]) {
|
||||
Uint8 data = packet->rgucButtons[1];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (packet->ucStickHat != ctx->m_lastInputOnlyState.ucStickHat) {
|
||||
@ -1596,30 +1596,30 @@ static void HandleInputOnlyControllerState(SDL_Joystick *joystick, SDL_DriverSwi
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
|
||||
if (packet->rgucJoystickLeft[0] != ctx->m_lastInputOnlyState.rgucJoystickLeft[0]) {
|
||||
axis = (Sint16)HIDAPI_RemapVal(packet->rgucJoystickLeft[0], SDL_MIN_UINT8, SDL_MAX_UINT8, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
}
|
||||
|
||||
if (packet->rgucJoystickLeft[1] != ctx->m_lastInputOnlyState.rgucJoystickLeft[1]) {
|
||||
axis = (Sint16)HIDAPI_RemapVal(packet->rgucJoystickLeft[1], SDL_MIN_UINT8, SDL_MAX_UINT8, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
}
|
||||
|
||||
if (packet->rgucJoystickRight[0] != ctx->m_lastInputOnlyState.rgucJoystickRight[0]) {
|
||||
axis = (Sint16)HIDAPI_RemapVal(packet->rgucJoystickRight[0], SDL_MIN_UINT8, SDL_MAX_UINT8, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
}
|
||||
|
||||
if (packet->rgucJoystickRight[1] != ctx->m_lastInputOnlyState.rgucJoystickRight[1]) {
|
||||
axis = (Sint16)HIDAPI_RemapVal(packet->rgucJoystickRight[1], SDL_MIN_UINT8, SDL_MAX_UINT8, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
}
|
||||
|
||||
ctx->m_lastInputOnlyState = *packet;
|
||||
@ -1632,28 +1632,28 @@ static void HandleSimpleControllerState(SDL_Joystick *joystick, SDL_DriverSwitch
|
||||
|
||||
if (packet->rgucButtons[0] != ctx->m_lastSimpleState.rgucButtons[0]) {
|
||||
Uint8 data = packet->rgucButtons[0];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_A), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_B), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_X), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_Y), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
axis = (data & 0x40) ? 32767 : -32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
|
||||
axis = (data & 0x80) ? 32767 : -32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
}
|
||||
|
||||
if (packet->rgucButtons[1] != ctx->m_lastSimpleState.rgucButtons[1]) {
|
||||
Uint8 data = packet->rgucButtons[1];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (packet->ucStickHat != ctx->m_lastSimpleState.ucStickHat) {
|
||||
@ -1694,23 +1694,23 @@ static void HandleSimpleControllerState(SDL_Joystick *joystick, SDL_DriverSwitch
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
|
||||
axis = ApplySimpleStickCalibration(ctx, 0, 0, packet->sJoystickLeft[0]);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
|
||||
axis = ApplySimpleStickCalibration(ctx, 0, 1, packet->sJoystickLeft[1]);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
|
||||
axis = ApplySimpleStickCalibration(ctx, 1, 0, packet->sJoystickRight[0]);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
|
||||
axis = ApplySimpleStickCalibration(ctx, 1, 1, packet->sJoystickRight[1]);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
ctx->m_lastSimpleState = *packet;
|
||||
}
|
||||
@ -1765,31 +1765,31 @@ static void HandleCombinedControllerStateL(Uint64 timestamp, SDL_Joystick *joyst
|
||||
|
||||
if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[1];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (packet->controllerState.rgucButtons[2] != ctx->m_lastFullState.controllerState.rgucButtons[2]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[2];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PADDLE4, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PADDLE2, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_PADDLE4, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_PADDLE2, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
axis = (data & 0x80) ? 32767 : -32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
}
|
||||
|
||||
axis = packet->controllerState.rgucJoystickLeft[0] | ((packet->controllerState.rgucJoystickLeft[1] & 0xF) << 8);
|
||||
axis = ApplyStickCalibration(ctx, 0, 0, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
|
||||
axis = ((packet->controllerState.rgucJoystickLeft[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickLeft[2] << 4);
|
||||
axis = ApplyStickCalibration(ctx, 0, 1, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, ~axis);
|
||||
}
|
||||
|
||||
static void HandleMiniControllerStateL(Uint64 timestamp, SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet)
|
||||
@ -1798,30 +1798,30 @@ static void HandleMiniControllerStateL(Uint64 timestamp, SDL_Joystick *joystick,
|
||||
|
||||
if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[1];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (packet->controllerState.rgucButtons[2] != ctx->m_lastFullState.controllerState.rgucButtons[2]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[2];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PADDLE2, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PADDLE4, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_A), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_Y), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_X), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_B), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_PADDLE2, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_PADDLE4, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
axis = packet->controllerState.rgucJoystickLeft[0] | ((packet->controllerState.rgucJoystickLeft[1] & 0xF) << 8);
|
||||
axis = ApplyStickCalibration(ctx, 0, 0, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, ~axis);
|
||||
|
||||
axis = ((packet->controllerState.rgucJoystickLeft[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickLeft[2] << 4);
|
||||
axis = ApplyStickCalibration(ctx, 0, 1, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, ~axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, ~axis);
|
||||
}
|
||||
|
||||
static void HandleCombinedControllerStateR(Uint64 timestamp, SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet)
|
||||
@ -1830,31 +1830,31 @@ static void HandleCombinedControllerStateR(Uint64 timestamp, SDL_Joystick *joyst
|
||||
|
||||
if (packet->controllerState.rgucButtons[0] != ctx->m_lastFullState.controllerState.rgucButtons[0]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[0];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PADDLE1, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PADDLE3, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_A), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_B), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_X), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_PADDLE1, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_PADDLE3, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
axis = (data & 0x80) ? 32767 : -32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
}
|
||||
|
||||
if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[1];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
axis = packet->controllerState.rgucJoystickRight[0] | ((packet->controllerState.rgucJoystickRight[1] & 0xF) << 8);
|
||||
axis = ApplyStickCalibration(ctx, 1, 0, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
|
||||
axis = ((packet->controllerState.rgucJoystickRight[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickRight[2] << 4);
|
||||
axis = ApplyStickCalibration(ctx, 1, 1, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, ~axis);
|
||||
}
|
||||
|
||||
static void HandleMiniControllerStateR(Uint64 timestamp, SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet)
|
||||
@ -1863,30 +1863,30 @@ static void HandleMiniControllerStateR(Uint64 timestamp, SDL_Joystick *joystick,
|
||||
|
||||
if (packet->controllerState.rgucButtons[0] != ctx->m_lastFullState.controllerState.rgucButtons[0]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[0];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PADDLE1, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_PADDLE3, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_B), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_Y), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_A), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_X), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_PADDLE1, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_PADDLE3, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[1];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
axis = packet->controllerState.rgucJoystickRight[0] | ((packet->controllerState.rgucJoystickRight[1] & 0xF) << 8);
|
||||
axis = ApplyStickCalibration(ctx, 1, 0, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
|
||||
axis = ((packet->controllerState.rgucJoystickRight[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickRight[2] << 4);
|
||||
axis = ApplyStickCalibration(ctx, 1, 1, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
}
|
||||
|
||||
static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) SDL_NO_THREAD_SAFETY_ANALYSIS /* We unlock and lock the device lock to be able to change IMU state */
|
||||
@ -1910,52 +1910,52 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
|
||||
|
||||
if (packet->controllerState.rgucButtons[0] != ctx->m_lastFullState.controllerState.rgucButtons[0]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[0];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_A), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_B), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_X), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, RemapButton(ctx, SDL_GAMEPAD_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
axis = (data & 0x80) ? 32767 : -32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
}
|
||||
|
||||
if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[1];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (packet->controllerState.rgucButtons[2] != ctx->m_lastFullState.controllerState.rgucButtons[2]) {
|
||||
Uint8 data = packet->controllerState.rgucButtons[2];
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
axis = (data & 0x80) ? 32767 : -32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
}
|
||||
|
||||
axis = packet->controllerState.rgucJoystickLeft[0] | ((packet->controllerState.rgucJoystickLeft[1] & 0xF) << 8);
|
||||
axis = ApplyStickCalibration(ctx, 0, 0, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
|
||||
axis = ((packet->controllerState.rgucJoystickLeft[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickLeft[2] << 4);
|
||||
axis = ApplyStickCalibration(ctx, 0, 1, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, ~axis);
|
||||
|
||||
axis = packet->controllerState.rgucJoystickRight[0] | ((packet->controllerState.rgucJoystickRight[1] & 0xF) << 8);
|
||||
axis = ApplyStickCalibration(ctx, 1, 0, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
|
||||
axis = ((packet->controllerState.rgucJoystickRight[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickRight[2] << 4);
|
||||
axis = ApplyStickCalibration(ctx, 1, 1, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, ~axis);
|
||||
}
|
||||
|
||||
/* High nibble of battery/connection byte is battery level, low nibble is connection status
|
||||
|
@ -102,7 +102,7 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
k_eWiiButtons_A = SDL_CONTROLLER_BUTTON_MISC1,
|
||||
k_eWiiButtons_A = SDL_GAMEPAD_BUTTON_MISC1,
|
||||
k_eWiiButtons_B,
|
||||
k_eWiiButtons_One,
|
||||
k_eWiiButtons_Two,
|
||||
@ -178,7 +178,7 @@ static SDL_bool HIDAPI_DriverWii_IsEnabled(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverWii_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverWii_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
if (vendor_id == USB_VENDOR_NINTENDO &&
|
||||
(product_id == USB_PRODUCT_NINTENDO_WII_REMOTE ||
|
||||
@ -804,7 +804,7 @@ static SDL_bool HIDAPI_DriverWii_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joy
|
||||
/* Maximum is Classic Controller + Wiimote */
|
||||
joystick->nbuttons = k_eWiiButtons_Max;
|
||||
}
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
|
||||
ctx->m_ulLastInput = SDL_GetTicks();
|
||||
|
||||
@ -895,7 +895,7 @@ static void PostStickCalibrated(Uint64 timestamp, SDL_Joystick *joystick, struct
|
||||
float fvalue = (float)distance / (float)range;
|
||||
value = (Sint16)(fvalue * SDL_JOYSTICK_AXIS_MAX);
|
||||
}
|
||||
if (axis == SDL_CONTROLLER_AXIS_LEFTY || axis == SDL_CONTROLLER_AXIS_RIGHTY) {
|
||||
if (axis == SDL_GAMEPAD_AXIS_LEFTY || axis == SDL_GAMEPAD_AXIS_RIGHTY) {
|
||||
if (value) {
|
||||
value = ~value;
|
||||
}
|
||||
@ -928,27 +928,27 @@ static void PostPackedButtonData(Uint64 timestamp, SDL_Joystick *joystick, const
|
||||
static const Uint8 GAMEPAD_BUTTON_DEFS[3][8] = {
|
||||
{
|
||||
0xFF /* Unused */,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_START,
|
||||
SDL_CONTROLLER_BUTTON_GUIDE,
|
||||
SDL_CONTROLLER_BUTTON_BACK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_START,
|
||||
SDL_GAMEPAD_BUTTON_GUIDE,
|
||||
SDL_GAMEPAD_BUTTON_BACK,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_DOWN,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_RIGHT,
|
||||
},
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_DPAD_UP,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_UP,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_LEFT,
|
||||
0xFF /* ZR */,
|
||||
SDL_CONTROLLER_BUTTON_X,
|
||||
SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_CONTROLLER_BUTTON_Y,
|
||||
SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_GAMEPAD_BUTTON_X,
|
||||
SDL_GAMEPAD_BUTTON_A,
|
||||
SDL_GAMEPAD_BUTTON_Y,
|
||||
SDL_GAMEPAD_BUTTON_B,
|
||||
0xFF /*ZL*/,
|
||||
},
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSTICK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSTICK,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_STICK,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_STICK,
|
||||
0xFF /* Charging */,
|
||||
0xFF /* Plugged In */,
|
||||
0xFF /* Unused */,
|
||||
@ -961,27 +961,27 @@ static const Uint8 GAMEPAD_BUTTON_DEFS[3][8] = {
|
||||
static const Uint8 GAMEPAD_BUTTON_DEFS_POSITIONAL[3][8] = {
|
||||
{
|
||||
0xFF /* Unused */,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_START,
|
||||
SDL_CONTROLLER_BUTTON_GUIDE,
|
||||
SDL_CONTROLLER_BUTTON_BACK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_START,
|
||||
SDL_GAMEPAD_BUTTON_GUIDE,
|
||||
SDL_GAMEPAD_BUTTON_BACK,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_DOWN,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_RIGHT,
|
||||
},
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_DPAD_UP,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_UP,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_LEFT,
|
||||
0xFF /* ZR */,
|
||||
SDL_CONTROLLER_BUTTON_Y,
|
||||
SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_CONTROLLER_BUTTON_X,
|
||||
SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_GAMEPAD_BUTTON_Y,
|
||||
SDL_GAMEPAD_BUTTON_B,
|
||||
SDL_GAMEPAD_BUTTON_X,
|
||||
SDL_GAMEPAD_BUTTON_A,
|
||||
0xFF /*ZL*/,
|
||||
},
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSTICK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSTICK,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_STICK,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_STICK,
|
||||
0xFF /* Charging */,
|
||||
0xFF /* Plugged In */,
|
||||
0xFF /* Unused */,
|
||||
@ -994,27 +994,27 @@ static const Uint8 GAMEPAD_BUTTON_DEFS_POSITIONAL[3][8] = {
|
||||
static const Uint8 MP_GAMEPAD_BUTTON_DEFS[3][8] = {
|
||||
{
|
||||
0xFF /* Unused */,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_START,
|
||||
SDL_CONTROLLER_BUTTON_GUIDE,
|
||||
SDL_CONTROLLER_BUTTON_BACK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_START,
|
||||
SDL_GAMEPAD_BUTTON_GUIDE,
|
||||
SDL_GAMEPAD_BUTTON_BACK,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_DOWN,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_RIGHT,
|
||||
},
|
||||
{
|
||||
0xFF /* Motion Plus data */,
|
||||
0xFF /* Motion Plus data */,
|
||||
0xFF /* ZR */,
|
||||
SDL_CONTROLLER_BUTTON_X,
|
||||
SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_CONTROLLER_BUTTON_Y,
|
||||
SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_GAMEPAD_BUTTON_X,
|
||||
SDL_GAMEPAD_BUTTON_A,
|
||||
SDL_GAMEPAD_BUTTON_Y,
|
||||
SDL_GAMEPAD_BUTTON_B,
|
||||
0xFF /*ZL*/,
|
||||
},
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSTICK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSTICK,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_STICK,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_STICK,
|
||||
0xFF /* Charging */,
|
||||
0xFF /* Plugged In */,
|
||||
0xFF /* Unused */,
|
||||
@ -1027,27 +1027,27 @@ static const Uint8 MP_GAMEPAD_BUTTON_DEFS[3][8] = {
|
||||
static const Uint8 MP_GAMEPAD_BUTTON_DEFS_POSITIONAL[3][8] = {
|
||||
{
|
||||
0xFF /* Unused */,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_START,
|
||||
SDL_CONTROLLER_BUTTON_GUIDE,
|
||||
SDL_CONTROLLER_BUTTON_BACK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_START,
|
||||
SDL_GAMEPAD_BUTTON_GUIDE,
|
||||
SDL_GAMEPAD_BUTTON_BACK,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_DOWN,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_RIGHT,
|
||||
},
|
||||
{
|
||||
0xFF /* Motion Plus data */,
|
||||
0xFF /* Motion Plus data */,
|
||||
0xFF /* ZR */,
|
||||
SDL_CONTROLLER_BUTTON_Y,
|
||||
SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_CONTROLLER_BUTTON_X,
|
||||
SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_GAMEPAD_BUTTON_Y,
|
||||
SDL_GAMEPAD_BUTTON_B,
|
||||
SDL_GAMEPAD_BUTTON_X,
|
||||
SDL_GAMEPAD_BUTTON_A,
|
||||
0xFF /*ZL*/,
|
||||
},
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSTICK,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSTICK,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_STICK,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_STICK,
|
||||
0xFF /* Charging */,
|
||||
0xFF /* Plugged In */,
|
||||
0xFF /* Unused */,
|
||||
@ -1059,7 +1059,7 @@ static const Uint8 MP_GAMEPAD_BUTTON_DEFS_POSITIONAL[3][8] = {
|
||||
|
||||
static const Uint8 MP_FIXUP_DPAD_BUTTON_DEFS[2][8] = {
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_DPAD_UP,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_UP,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
@ -1069,7 +1069,7 @@ static const Uint8 MP_FIXUP_DPAD_BUTTON_DEFS[2][8] = {
|
||||
0xFF,
|
||||
},
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_LEFT,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
@ -1082,7 +1082,7 @@ static const Uint8 MP_FIXUP_DPAD_BUTTON_DEFS[2][8] = {
|
||||
|
||||
static void HandleWiiUProButtonData(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick, const WiiButtonData *data)
|
||||
{
|
||||
static const Uint8 axes[] = { SDL_CONTROLLER_AXIS_LEFTX, SDL_CONTROLLER_AXIS_RIGHTX, SDL_CONTROLLER_AXIS_LEFTY, SDL_CONTROLLER_AXIS_RIGHTY };
|
||||
static const Uint8 axes[] = { SDL_GAMEPAD_AXIS_LEFTX, SDL_GAMEPAD_AXIS_RIGHTX, SDL_GAMEPAD_AXIS_LEFTY, SDL_GAMEPAD_AXIS_RIGHTY };
|
||||
const Uint8(*buttons)[8] = ctx->m_bUseButtonLabels ? GAMEPAD_BUTTON_DEFS : GAMEPAD_BUTTON_DEFS_POSITIONAL;
|
||||
Uint8 zl, zr;
|
||||
int i;
|
||||
@ -1097,8 +1097,8 @@ static void HandleWiiUProButtonData(SDL_DriverWii_Context *ctx, SDL_Joystick *jo
|
||||
/* Triggers */
|
||||
zl = data->rgucExtension[9] & 0x80;
|
||||
zr = data->rgucExtension[9] & 0x04;
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, zl ? SDL_JOYSTICK_AXIS_MIN : SDL_JOYSTICK_AXIS_MAX);
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, zr ? SDL_JOYSTICK_AXIS_MIN : SDL_JOYSTICK_AXIS_MAX);
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, zl ? SDL_JOYSTICK_AXIS_MIN : SDL_JOYSTICK_AXIS_MAX);
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, zr ? SDL_JOYSTICK_AXIS_MIN : SDL_JOYSTICK_AXIS_MAX);
|
||||
|
||||
/* Sticks */
|
||||
for (i = 0; i < 4; i++) {
|
||||
@ -1128,8 +1128,8 @@ static void HandleGamepadControllerButtonData(SDL_DriverWii_Context *ctx, SDL_Jo
|
||||
/* Triggers */
|
||||
zl = data->rgucExtension[5] & 0x80;
|
||||
zr = data->rgucExtension[5] & 0x04;
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, zl ? SDL_JOYSTICK_AXIS_MIN : SDL_JOYSTICK_AXIS_MAX);
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, zr ? SDL_JOYSTICK_AXIS_MIN : SDL_JOYSTICK_AXIS_MAX);
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, zl ? SDL_JOYSTICK_AXIS_MIN : SDL_JOYSTICK_AXIS_MAX);
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, zr ? SDL_JOYSTICK_AXIS_MIN : SDL_JOYSTICK_AXIS_MAX);
|
||||
|
||||
/* Sticks */
|
||||
if (ctx->m_ucMotionPlusMode == WII_MOTIONPLUS_MODE_GAMEPAD) {
|
||||
@ -1141,10 +1141,10 @@ static void HandleGamepadControllerButtonData(SDL_DriverWii_Context *ctx, SDL_Jo
|
||||
}
|
||||
rx = (data->rgucExtension[2] >> 7) | ((data->rgucExtension[1] >> 5) & 0x06) | ((data->rgucExtension[0] >> 3) & 0x18);
|
||||
ry = data->rgucExtension[2] & 0x1F;
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[0], SDL_CONTROLLER_AXIS_LEFTX, lx);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[1], SDL_CONTROLLER_AXIS_LEFTY, ly);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[2], SDL_CONTROLLER_AXIS_RIGHTX, rx);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[3], SDL_CONTROLLER_AXIS_RIGHTY, ry);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[0], SDL_GAMEPAD_AXIS_LEFTX, lx);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[1], SDL_GAMEPAD_AXIS_LEFTY, ly);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[2], SDL_GAMEPAD_AXIS_RIGHTX, rx);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[3], SDL_GAMEPAD_AXIS_RIGHTY, ry);
|
||||
}
|
||||
|
||||
static void HandleWiiRemoteButtonData(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick, const WiiButtonData *data)
|
||||
@ -1184,24 +1184,24 @@ static void HandleWiiRemoteButtonDataAsMainController(SDL_DriverWii_Context *ctx
|
||||
*/
|
||||
static const Uint8 buttons[2][8] = {
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
|
||||
SDL_CONTROLLER_BUTTON_DPAD_UP,
|
||||
SDL_CONTROLLER_BUTTON_START,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_LEFT,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_RIGHT,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_DOWN,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_UP,
|
||||
SDL_GAMEPAD_BUTTON_START,
|
||||
0xFF /* Unused */,
|
||||
0xFF /* Unused */,
|
||||
0xFF /* Unused */,
|
||||
},
|
||||
{
|
||||
SDL_CONTROLLER_BUTTON_Y,
|
||||
SDL_CONTROLLER_BUTTON_X,
|
||||
SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_CONTROLLER_BUTTON_BACK,
|
||||
SDL_GAMEPAD_BUTTON_Y,
|
||||
SDL_GAMEPAD_BUTTON_X,
|
||||
SDL_GAMEPAD_BUTTON_A,
|
||||
SDL_GAMEPAD_BUTTON_B,
|
||||
SDL_GAMEPAD_BUTTON_BACK,
|
||||
0xFF /* Unused */,
|
||||
0xFF /* Unused */,
|
||||
SDL_CONTROLLER_BUTTON_GUIDE,
|
||||
SDL_GAMEPAD_BUTTON_GUIDE,
|
||||
}
|
||||
};
|
||||
if (data->hasBaseButtons) {
|
||||
@ -1224,10 +1224,10 @@ static void HandleNunchuckButtonData(SDL_DriverWii_Context *ctx, SDL_Joystick *j
|
||||
c_button = (data->rgucExtension[5] & 0x02) ? SDL_RELEASED : SDL_PRESSED;
|
||||
z_button = (data->rgucExtension[5] & 0x01) ? SDL_RELEASED : SDL_PRESSED;
|
||||
}
|
||||
SDL_PrivateJoystickButton(ctx->timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, c_button);
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, z_button ? SDL_JOYSTICK_AXIS_MAX : SDL_JOYSTICK_AXIS_MIN);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[0], SDL_CONTROLLER_AXIS_LEFTX, data->rgucExtension[0]);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[1], SDL_CONTROLLER_AXIS_LEFTY, data->rgucExtension[1]);
|
||||
SDL_PrivateJoystickButton(ctx->timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, c_button);
|
||||
SDL_PrivateJoystickAxis(ctx->timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, z_button ? SDL_JOYSTICK_AXIS_MAX : SDL_JOYSTICK_AXIS_MIN);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[0], SDL_GAMEPAD_AXIS_LEFTX, data->rgucExtension[0]);
|
||||
PostStickCalibrated(ctx->timestamp, joystick, &ctx->m_StickCalibrationData[1], SDL_GAMEPAD_AXIS_LEFTY, data->rgucExtension[1]);
|
||||
|
||||
if (ctx->m_bReportSensors) {
|
||||
const float ACCEL_RES_PER_G = 200.0f;
|
||||
|
@ -59,7 +59,7 @@ static SDL_bool HIDAPI_DriverXbox360_IsEnabled(void)
|
||||
SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT)));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
const int XB360W_IFACE_PROTOCOL = 129; /* Wireless */
|
||||
|
||||
@ -68,7 +68,7 @@ static SDL_bool HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if ((vendor_id == USB_VENDOR_MICROSOFT && (product_id == 0x0291 || product_id == 0x0719)) ||
|
||||
(type == SDL_CONTROLLER_TYPE_XBOX360 && interface_protocol == XB360W_IFACE_PROTOCOL)) {
|
||||
(type == SDL_GAMEPAD_TYPE_XBOX360 && interface_protocol == XB360W_IFACE_PROTOCOL)) {
|
||||
/* This is the wireless dongle, which talks a different protocol */
|
||||
return SDL_FALSE;
|
||||
}
|
||||
@ -92,9 +92,9 @@ static SDL_bool HIDAPI_DriverXbox360_IsSupportedDevice(SDL_HIDAPI_Device *device
|
||||
if (SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
return (type == SDL_CONTROLLER_TYPE_XBOX360 || type == SDL_CONTROLLER_TYPE_XBOXONE) ? SDL_TRUE : SDL_FALSE;
|
||||
return (type == SDL_GAMEPAD_TYPE_XBOX360 || type == SDL_GAMEPAD_TYPE_XBOXONE) ? SDL_TRUE : SDL_FALSE;
|
||||
#else
|
||||
return (type == SDL_CONTROLLER_TYPE_XBOX360) ? SDL_TRUE : SDL_FALSE;
|
||||
return (type == SDL_GAMEPAD_TYPE_XBOX360) ? SDL_TRUE : SDL_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ static SDL_bool HIDAPI_DriverXbox360_InitDevice(SDL_HIDAPI_Device *device)
|
||||
|
||||
device->context = ctx;
|
||||
|
||||
device->type = SDL_CONTROLLER_TYPE_XBOX360;
|
||||
device->type = SDL_GAMEPAD_TYPE_XBOX360;
|
||||
|
||||
return HIDAPI_JoystickConnected(device, NULL);
|
||||
}
|
||||
@ -187,7 +187,7 @@ static SDL_bool HIDAPI_DriverXbox360_OpenJoystick(SDL_HIDAPI_Device *device, SDL
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
joystick->nbuttons = 15;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;
|
||||
|
||||
return SDL_TRUE;
|
||||
@ -268,44 +268,44 @@ static void HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
if (ctx->last_state[2] != data[2]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data[2] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, (data[2] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[3] != data[3]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
axis = ((int)data[4] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = ((int)data[5] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[6]));
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[8]));
|
||||
if (invert_y_axes) {
|
||||
axis = ~axis;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[10]));
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[12]));
|
||||
if (invert_y_axes) {
|
||||
axis = ~axis;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state)));
|
||||
}
|
||||
|
@ -61,12 +61,12 @@ static SDL_bool HIDAPI_DriverXbox360W_IsEnabled(void)
|
||||
SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX_360, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT))));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverXbox360W_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverXbox360W_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
const int XB360W_IFACE_PROTOCOL = 129; /* Wireless */
|
||||
|
||||
if ((vendor_id == USB_VENDOR_MICROSOFT && (product_id == 0x0291 || product_id == 0x02a9 || product_id == 0x0719) && interface_protocol == 0) ||
|
||||
(type == SDL_CONTROLLER_TYPE_XBOX360 && interface_protocol == XB360W_IFACE_PROTOCOL)) {
|
||||
(type == SDL_GAMEPAD_TYPE_XBOX360 && interface_protocol == XB360W_IFACE_PROTOCOL)) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
return SDL_FALSE;
|
||||
@ -144,7 +144,7 @@ static SDL_bool HIDAPI_DriverXbox360W_InitDevice(SDL_HIDAPI_Device *device)
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
device->type = SDL_CONTROLLER_TYPE_XBOX360;
|
||||
device->type = SDL_GAMEPAD_TYPE_XBOX360;
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
@ -185,7 +185,7 @@ static SDL_bool HIDAPI_DriverXbox360W_OpenJoystick(SDL_HIDAPI_Device *device, SD
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
joystick->nbuttons = 15;
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN;
|
||||
|
||||
return SDL_TRUE;
|
||||
@ -237,44 +237,44 @@ static void HIDAPI_DriverXbox360W_HandleStatePacket(SDL_Joystick *joystick, SDL_
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
if (ctx->last_state[2] != data[2]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data[2] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, (data[2] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[3] != data[3]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
axis = ((int)data[4] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
axis = ((int)data[5] * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[6]));
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[8]));
|
||||
if (invert_y_axes) {
|
||||
axis = ~axis;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[10]));
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[12]));
|
||||
if (invert_y_axes) {
|
||||
axis = ~axis;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state)));
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ static SDL_bool HIDAPI_DriverXboxOne_IsEnabled(void)
|
||||
SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_XBOX, SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT)));
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
#ifdef __MACOS__
|
||||
/* Wired Xbox One controllers are handled by the 360Controller driver */
|
||||
@ -356,7 +356,7 @@ static SDL_bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device
|
||||
return SDL_FALSE;
|
||||
}
|
||||
#endif
|
||||
return (type == SDL_CONTROLLER_TYPE_XBOXONE) ? SDL_TRUE : SDL_FALSE;
|
||||
return (type == SDL_GAMEPAD_TYPE_XBOXONE) ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
static SDL_bool HIDAPI_DriverXboxOne_InitDevice(SDL_HIDAPI_Device *device)
|
||||
@ -393,7 +393,7 @@ static SDL_bool HIDAPI_DriverXboxOne_InitDevice(SDL_HIDAPI_Device *device)
|
||||
SDL_Log("Controller version: %d (0x%.4x)\n", device->version, device->version);
|
||||
#endif
|
||||
|
||||
device->type = SDL_CONTROLLER_TYPE_XBOXONE;
|
||||
device->type = SDL_GAMEPAD_TYPE_XBOXONE;
|
||||
|
||||
return HIDAPI_JoystickConnected(device, NULL);
|
||||
}
|
||||
@ -430,7 +430,7 @@ static SDL_bool HIDAPI_DriverXboxOne_OpenJoystick(SDL_HIDAPI_Device *device, SDL
|
||||
if (ctx->has_paddles) {
|
||||
joystick->nbuttons += 4;
|
||||
}
|
||||
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
|
||||
if (!ctx->bluetooth) {
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;
|
||||
@ -638,7 +638,7 @@ static void HIDAPI_DriverXboxOne_HandleUnmappedStatePacket(SDL_Joystick *joystic
|
||||
}
|
||||
|
||||
if (ctx->last_paddle_state != data[paddle_index]) {
|
||||
int nButton = SDL_CONTROLLER_BUTTON_MISC1 + ctx->has_share_button; /* Next available button */
|
||||
int nButton = SDL_GAMEPAD_BUTTON_MISC1 + ctx->has_share_button; /* Next available button */
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button1_bit) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button2_bit) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button3_bit) ? SDL_PRESSED : SDL_RELEASED);
|
||||
@ -654,29 +654,29 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
if (ctx->last_state[4] != data[4]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[4] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[4] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[4] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[4] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[4] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[4] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[4] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[4] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[4] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[4] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[4] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[4] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[5] != data[5]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data[5] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data[5] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data[5] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data[5] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, (data[5] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, (data[5] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, (data[5] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, (data[5] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
if (ctx->vendor_id == USB_VENDOR_RAZER && ctx->product_id == USB_PRODUCT_RAZER_ATROX) {
|
||||
/* The Razer Atrox has the right and left shoulder bits reversed */
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[5] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[5] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[5] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[5] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
} else {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[5] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[5] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[5] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[5] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[5] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[5] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[5] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[5] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->has_share_button) {
|
||||
@ -687,15 +687,15 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
*/
|
||||
if (size < 48) {
|
||||
if (ctx->last_state[18] != data[18]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[18] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data[18] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
} else if (size == 48) {
|
||||
if (ctx->last_state[22] != data[22]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[22] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data[22] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
} else if (size == 50) {
|
||||
if (ctx->last_state[32] != data[32]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[32] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data[32] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -766,7 +766,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
}
|
||||
|
||||
if (ctx->last_paddle_state != data[paddle_index]) {
|
||||
int nButton = SDL_CONTROLLER_BUTTON_MISC1 + ctx->has_share_button; /* Next available button */
|
||||
int nButton = SDL_GAMEPAD_BUTTON_MISC1 + ctx->has_share_button; /* Next available button */
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button1_bit) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button2_bit) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button3_bit) ? SDL_PRESSED : SDL_RELEASED);
|
||||
@ -782,7 +782,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
if (axis == -32768 && size == 30 && (data[22] & 0x80) != 0) {
|
||||
axis = 32767;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
|
||||
axis = ((int)SDL_SwapLE16(*(Sint16 *)(&data[8])) * 64) - 32768;
|
||||
if (axis == -32768 && size == 30 && (data[22] & 0x40) != 0) {
|
||||
@ -791,16 +791,16 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
|
||||
if (axis == 32704) {
|
||||
axis = 32767;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[10]));
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[12]));
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, ~axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[14]));
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = SDL_SwapLE16(*(Sint16 *)(&data[16]));
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, ~axis);
|
||||
|
||||
SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state)));
|
||||
}
|
||||
@ -816,7 +816,7 @@ static void HIDAPI_DriverXboxOne_HandleModePacket(SDL_Joystick *joystick, SDL_Dr
|
||||
{
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[4] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[4] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -825,19 +825,19 @@ static void HIDAPI_DriverXboxOne_HandleModePacket(SDL_Joystick *joystick, SDL_Dr
|
||||
static void HIDAPI_DriverXboxOneBluetooth_HandleButtons16(Uint64 timestamp, SDL_Joystick *joystick, SDL_DriverXboxOne_Context *ctx, const Uint8 *data, int size)
|
||||
{
|
||||
if (ctx->last_state[14] != data[14]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[14] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[14] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[14] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[14] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[14] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[14] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[14] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[14] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[14] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[14] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[14] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[14] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[14] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[14] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[14] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[14] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[15] != data[15]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[15] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[15] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[15] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[15] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -852,28 +852,28 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleButtons16(Uint64 timestamp, SDL_
|
||||
static void HIDAPI_DriverXboxOneBluetooth_HandleButtons(Uint64 timestamp, SDL_Joystick *joystick, SDL_DriverXboxOne_Context *ctx, Uint8 *data, int size)
|
||||
{
|
||||
if (ctx->last_state[14] != data[14]) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_A, (data[14] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_B, (data[14] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_X, (data[14] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_Y, (data[14] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[14] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[14] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_A, (data[14] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_B, (data[14] & 0x02) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_X, (data[14] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_Y, (data[14] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, (data[14] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, (data[14] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->last_state[15] != data[15]) {
|
||||
if (!ctx->has_guide_packet) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[15] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[15] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_START, (data[15] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[15] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[15] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START, (data[15] & 0x08) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, (data[15] & 0x20) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, (data[15] & 0x40) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
if (ctx->has_share_button) {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, (data[15] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[16] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, (data[15] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1, (data[16] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
} else {
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_BACK, ((data[15] & 0x04) || (data[16] & 0x01)) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK, ((data[15] & 0x04) || (data[16] & 0x01)) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -930,7 +930,7 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleButtons(Uint64 timestamp, SDL_Jo
|
||||
}
|
||||
|
||||
if (ctx->last_paddle_state != data[paddle_index]) {
|
||||
int nButton = SDL_CONTROLLER_BUTTON_MISC1; /* Next available button */
|
||||
int nButton = SDL_GAMEPAD_BUTTON_MISC1; /* Next available button */
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button1_bit) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button2_bit) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, nButton++, (data[paddle_index] & button3_bit) ? SDL_PRESSED : SDL_RELEASED);
|
||||
@ -995,32 +995,32 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(SDL_Joystick *joysti
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_DOWN, dpad_down);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP, dpad_up);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, dpad_right);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_LEFT, dpad_left);
|
||||
}
|
||||
|
||||
axis = ((int)SDL_SwapLE16(*(Sint16 *)(&data[9])) * 64) - 32768;
|
||||
if (axis == 32704) {
|
||||
axis = 32767;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
|
||||
|
||||
axis = ((int)SDL_SwapLE16(*(Sint16 *)(&data[11])) * 64) - 32768;
|
||||
if (axis == 32704) {
|
||||
axis = 32767;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
|
||||
|
||||
axis = (int)SDL_SwapLE16(*(Uint16 *)(&data[1])) - 0x8000;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
axis = (int)SDL_SwapLE16(*(Uint16 *)(&data[3])) - 0x8000;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_LEFTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTY, axis);
|
||||
axis = (int)SDL_SwapLE16(*(Uint16 *)(&data[5])) - 0x8000;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTX, axis);
|
||||
axis = (int)SDL_SwapLE16(*(Uint16 *)(&data[7])) - 0x8000;
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
SDL_PrivateJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
|
||||
|
||||
SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state)));
|
||||
}
|
||||
@ -1030,7 +1030,7 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleGuidePacket(SDL_Joystick *joysti
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
ctx->has_guide_packet = SDL_TRUE;
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
SDL_PrivateJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||
}
|
||||
|
||||
static void HIDAPI_DriverXboxOneBluetooth_HandleBatteryPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_Context *ctx, const Uint8 *data, int size)
|
||||
|
@ -121,7 +121,7 @@ float HIDAPI_RemapVal(float val, float val_min, float val_max, float output_min,
|
||||
static void HIDAPI_UpdateDeviceList(void);
|
||||
static void HIDAPI_JoystickClose(SDL_Joystick *joystick);
|
||||
|
||||
static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
static SDL_GamepadType SDL_GetJoystickGameControllerProtocol(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF;
|
||||
static const int XB360_IFACE_SUBCLASS = 93;
|
||||
@ -130,7 +130,7 @@ static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char *
|
||||
static const int XBONE_IFACE_SUBCLASS = 71;
|
||||
static const int XBONE_IFACE_PROTOCOL = 208;
|
||||
|
||||
SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
SDL_GamepadType type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
|
||||
/* This code should match the checks in libusb/hid.c and HIDDeviceManager.java */
|
||||
if (interface_class == LIBUSB_CLASS_VENDOR_SPEC &&
|
||||
@ -169,7 +169,7 @@ static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char *
|
||||
int i;
|
||||
for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) {
|
||||
if (vendor == SUPPORTED_VENDORS[i]) {
|
||||
type = SDL_CONTROLLER_TYPE_XBOX360;
|
||||
type = SDL_GAMEPAD_TYPE_XBOX360;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -195,14 +195,14 @@ static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char *
|
||||
int i;
|
||||
for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) {
|
||||
if (vendor == SUPPORTED_VENDORS[i]) {
|
||||
type = SDL_CONTROLLER_TYPE_XBOXONE;
|
||||
type = SDL_GAMEPAD_TYPE_XBOXONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type == SDL_CONTROLLER_TYPE_UNKNOWN) {
|
||||
type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, name, SDL_FALSE);
|
||||
if (type == SDL_GAMEPAD_TYPE_UNKNOWN) {
|
||||
type = SDL_GetGamepadTypeFromVIDPID(vendor, product, name, SDL_FALSE);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@ -210,7 +210,7 @@ static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char *
|
||||
static SDL_bool HIDAPI_IsDeviceSupported(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
|
||||
{
|
||||
int i;
|
||||
SDL_GameControllerType type = SDL_GetJoystickGameControllerProtocol(name, vendor_id, product_id, -1, 0, 0, 0);
|
||||
SDL_GamepadType type = SDL_GetJoystickGameControllerProtocol(name, vendor_id, product_id, -1, 0, 0, 0);
|
||||
|
||||
for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) {
|
||||
SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i];
|
||||
@ -1016,13 +1016,13 @@ static SDL_bool HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id,
|
||||
|
||||
/* If we're looking for the raw input Xbox One controller, match it against any other Xbox One controller */
|
||||
if (product_id == USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER &&
|
||||
device->type == SDL_CONTROLLER_TYPE_XBOXONE) {
|
||||
device->type == SDL_GAMEPAD_TYPE_XBOXONE) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
/* If we're looking for an XInput controller, match it against any other Xbox controller */
|
||||
if (product_id == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) {
|
||||
if (device->type == SDL_CONTROLLER_TYPE_XBOX360 || device->type == SDL_CONTROLLER_TYPE_XBOXONE) {
|
||||
if (device->type == SDL_GAMEPAD_TYPE_XBOX360 || device->type == SDL_GAMEPAD_TYPE_XBOXONE) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ static SDL_bool HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id,
|
||||
if (vendor_id == USB_VENDOR_NVIDIA) {
|
||||
/* If we're looking for the NVIDIA SHIELD controller Xbox interface, match it against any NVIDIA SHIELD controller */
|
||||
if (product_id == 0xb400 &&
|
||||
device->type == SDL_CONTROLLER_TYPE_NVIDIA_SHIELD) {
|
||||
device->type == SDL_GAMEPAD_TYPE_NVIDIA_SHIELD) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
@ -1039,7 +1039,7 @@ static SDL_bool HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id,
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
HIDAPI_IsDeviceTypePresent(SDL_GameControllerType type)
|
||||
HIDAPI_IsDeviceTypePresent(SDL_GamepadType type)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
SDL_bool result = SDL_FALSE;
|
||||
@ -1139,11 +1139,11 @@ HIDAPI_GetJoystickTypeFromGUID(SDL_JoystickGUID guid)
|
||||
return type;
|
||||
}
|
||||
|
||||
SDL_GameControllerType
|
||||
HIDAPI_GetGameControllerTypeFromGUID(SDL_JoystickGUID guid)
|
||||
SDL_GamepadType
|
||||
HIDAPI_GetGamepadTypeFromGUID(SDL_JoystickGUID guid)
|
||||
{
|
||||
SDL_HIDAPI_Device *device;
|
||||
SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
SDL_GamepadType type = SDL_GAMEPAD_TYPE_UNKNOWN;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
for (device = SDL_HIDAPI_devices; device; device = device->next) {
|
||||
|
@ -65,7 +65,7 @@ typedef struct _SDL_HIDAPI_Device
|
||||
Uint16 usage; /* Available on Windows and macOS */
|
||||
SDL_bool is_bluetooth;
|
||||
SDL_JoystickType joystick_type;
|
||||
SDL_GameControllerType type;
|
||||
SDL_GamepadType type;
|
||||
|
||||
struct _SDL_HIDAPI_DeviceDriver *driver;
|
||||
void *context;
|
||||
@ -95,7 +95,7 @@ typedef struct _SDL_HIDAPI_DeviceDriver
|
||||
void (*RegisterHints)(SDL_HintCallback callback, void *userdata);
|
||||
void (*UnregisterHints)(SDL_HintCallback callback, void *userdata);
|
||||
SDL_bool (*IsEnabled)(void);
|
||||
SDL_bool (*IsSupportedDevice)(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol);
|
||||
SDL_bool (*IsSupportedDevice)(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol);
|
||||
SDL_bool (*InitDevice)(SDL_HIDAPI_Device *device);
|
||||
int (*GetDevicePlayerIndex)(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id);
|
||||
void (*SetDevicePlayerIndex)(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id, int player_index);
|
||||
@ -132,7 +132,7 @@ extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXbox360W;
|
||||
extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXboxOne;
|
||||
|
||||
/* Return true if a HID device is present and supported as a joystick of the given type */
|
||||
extern SDL_bool HIDAPI_IsDeviceTypePresent(SDL_GameControllerType type);
|
||||
extern SDL_bool HIDAPI_IsDeviceTypePresent(SDL_GamepadType type);
|
||||
|
||||
/* 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, const char *name);
|
||||
@ -141,7 +141,7 @@ extern SDL_bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint
|
||||
extern SDL_JoystickType HIDAPI_GetJoystickTypeFromGUID(SDL_JoystickGUID guid);
|
||||
|
||||
/* Return the type of a game controller if it's present and supported */
|
||||
extern SDL_GameControllerType HIDAPI_GetGameControllerTypeFromGUID(SDL_JoystickGUID guid);
|
||||
extern SDL_GamepadType HIDAPI_GetGamepadTypeFromGUID(SDL_JoystickGUID guid);
|
||||
|
||||
extern void HIDAPI_UpdateDevices(void);
|
||||
extern void HIDAPI_SetDeviceName(SDL_HIDAPI_Device *device, const char *name);
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Script to sort the game controller database entries in SDL_gamecontroller.c
|
||||
# Script to sort the game controller database entries in SDL_gamepad.c
|
||||
|
||||
import re
|
||||
|
||||
|
||||
filename = "SDL_gamecontrollerdb.h"
|
||||
filename = "SDL_gamepad_db.h"
|
||||
input = open(filename)
|
||||
output = open(f"{filename}.new", "w")
|
||||
parsing_controllers = False
|
||||
|
@ -165,24 +165,24 @@ int SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc)
|
||||
|
||||
if (hwdata->desc.axis_mask == 0) {
|
||||
if (hwdata->desc.naxes >= 2) {
|
||||
hwdata->desc.axis_mask |= ((1 << SDL_CONTROLLER_AXIS_LEFTX) | (1 << SDL_CONTROLLER_AXIS_LEFTY));
|
||||
hwdata->desc.axis_mask |= ((1 << SDL_GAMEPAD_AXIS_LEFTX) | (1 << SDL_GAMEPAD_AXIS_LEFTY));
|
||||
}
|
||||
if (hwdata->desc.naxes >= 4) {
|
||||
hwdata->desc.axis_mask |= ((1 << SDL_CONTROLLER_AXIS_RIGHTX) | (1 << SDL_CONTROLLER_AXIS_RIGHTY));
|
||||
hwdata->desc.axis_mask |= ((1 << SDL_GAMEPAD_AXIS_RIGHTX) | (1 << SDL_GAMEPAD_AXIS_RIGHTY));
|
||||
}
|
||||
if (hwdata->desc.naxes >= 6) {
|
||||
hwdata->desc.axis_mask |= ((1 << SDL_CONTROLLER_AXIS_TRIGGERLEFT) | (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT));
|
||||
hwdata->desc.axis_mask |= ((1 << SDL_GAMEPAD_AXIS_LEFT_TRIGGER) | (1 << SDL_GAMEPAD_AXIS_RIGHT_TRIGGER));
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the trigger axes */
|
||||
axis = 0;
|
||||
for (i = 0; axis < hwdata->desc.naxes && i < SDL_CONTROLLER_AXIS_MAX; ++i) {
|
||||
for (i = 0; axis < hwdata->desc.naxes && i < SDL_GAMEPAD_AXIS_MAX; ++i) {
|
||||
if (hwdata->desc.axis_mask & (1 << i)) {
|
||||
if (i == SDL_CONTROLLER_AXIS_TRIGGERLEFT) {
|
||||
if (i == SDL_GAMEPAD_AXIS_LEFT_TRIGGER) {
|
||||
axis_triggerleft = axis;
|
||||
}
|
||||
if (i == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) {
|
||||
if (i == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) {
|
||||
axis_triggerright = axis;
|
||||
}
|
||||
++axis;
|
||||
@ -583,132 +583,132 @@ static SDL_bool VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadM
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_A))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_A))) {
|
||||
out->a.kind = EMappingKind_Button;
|
||||
out->a.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_B))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_B))) {
|
||||
out->b.kind = EMappingKind_Button;
|
||||
out->b.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_X))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_X))) {
|
||||
out->x.kind = EMappingKind_Button;
|
||||
out->x.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_Y))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_Y))) {
|
||||
out->y.kind = EMappingKind_Button;
|
||||
out->y.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_BACK))) {
|
||||
out->back.kind = EMappingKind_Button;
|
||||
out->back.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_GUIDE))) {
|
||||
out->guide.kind = EMappingKind_Button;
|
||||
out->guide.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_START))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_START))) {
|
||||
out->start.kind = EMappingKind_Button;
|
||||
out->start.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_LEFT_STICK))) {
|
||||
out->leftstick.kind = EMappingKind_Button;
|
||||
out->leftstick.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_RIGHT_STICK))) {
|
||||
out->rightstick.kind = EMappingKind_Button;
|
||||
out->rightstick.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_LEFT_SHOULDER))) {
|
||||
out->leftshoulder.kind = EMappingKind_Button;
|
||||
out->leftshoulder.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER))) {
|
||||
out->rightshoulder.kind = EMappingKind_Button;
|
||||
out->rightshoulder.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_UP))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_DPAD_UP))) {
|
||||
out->dpup.kind = EMappingKind_Button;
|
||||
out->dpup.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_DOWN))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_DPAD_DOWN))) {
|
||||
out->dpdown.kind = EMappingKind_Button;
|
||||
out->dpdown.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_DPAD_LEFT))) {
|
||||
out->dpleft.kind = EMappingKind_Button;
|
||||
out->dpleft.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_RIGHT))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_DPAD_RIGHT))) {
|
||||
out->dpright.kind = EMappingKind_Button;
|
||||
out->dpright.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_MISC1))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_MISC1))) {
|
||||
out->misc1.kind = EMappingKind_Button;
|
||||
out->misc1.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE1))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_PADDLE1))) {
|
||||
out->paddle1.kind = EMappingKind_Button;
|
||||
out->paddle1.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE2))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_PADDLE2))) {
|
||||
out->paddle2.kind = EMappingKind_Button;
|
||||
out->paddle2.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE3))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_PADDLE3))) {
|
||||
out->paddle3.kind = EMappingKind_Button;
|
||||
out->paddle3.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE4))) {
|
||||
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_PADDLE4))) {
|
||||
out->paddle4.kind = EMappingKind_Button;
|
||||
out->paddle4.target = current_button++;
|
||||
}
|
||||
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_LEFTX))) {
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_GAMEPAD_AXIS_LEFTX))) {
|
||||
out->leftx.kind = EMappingKind_Axis;
|
||||
out->leftx.target = current_axis++;
|
||||
}
|
||||
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_LEFTY))) {
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_GAMEPAD_AXIS_LEFTY))) {
|
||||
out->lefty.kind = EMappingKind_Axis;
|
||||
out->lefty.target = current_axis++;
|
||||
}
|
||||
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_RIGHTX))) {
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_GAMEPAD_AXIS_RIGHTX))) {
|
||||
out->rightx.kind = EMappingKind_Axis;
|
||||
out->rightx.target = current_axis++;
|
||||
}
|
||||
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_RIGHTY))) {
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_GAMEPAD_AXIS_RIGHTY))) {
|
||||
out->righty.kind = EMappingKind_Axis;
|
||||
out->righty.target = current_axis++;
|
||||
}
|
||||
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERLEFT))) {
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_GAMEPAD_AXIS_LEFT_TRIGGER))) {
|
||||
out->lefttrigger.kind = EMappingKind_Axis;
|
||||
out->lefttrigger.target = current_axis++;
|
||||
}
|
||||
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT))) {
|
||||
if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_GAMEPAD_AXIS_RIGHT_TRIGGER))) {
|
||||
out->righttrigger.kind = EMappingKind_Axis;
|
||||
out->righttrigger.target = current_axis++;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ static int SetDIerror(const char *function, HRESULT code)
|
||||
static SDL_bool SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char *hidPath)
|
||||
{
|
||||
#ifdef SDL_JOYSTICK_XINPUT
|
||||
SDL_GameControllerType type;
|
||||
SDL_GamepadType type;
|
||||
|
||||
/* XInput and RawInput backends will pick up XInput-compatible devices */
|
||||
if (!SDL_XINPUT_Enabled()
|
||||
@ -256,9 +256,9 @@ static SDL_bool SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const ch
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor_id, product_id, NULL, SDL_FALSE);
|
||||
if (type == SDL_CONTROLLER_TYPE_XBOX360 ||
|
||||
type == SDL_CONTROLLER_TYPE_XBOXONE ||
|
||||
type = SDL_GetGamepadTypeFromVIDPID(vendor_id, product_id, NULL, SDL_FALSE);
|
||||
if (type == SDL_GAMEPAD_TYPE_XBOX360 ||
|
||||
type == SDL_GAMEPAD_TYPE_XBOXONE ||
|
||||
(vendor_id == USB_VENDOR_VALVE && product_id == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD)) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
@ -239,20 +239,20 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state
|
||||
/* Bitwise map .RLDUWVQTS.KYXBA -> YXBA..WVQTKSRLDU */
|
||||
(WORD)(match_state << 12 | (match_state & 0x0780) >> 1 | (match_state & 0x0010) << 1 | (match_state & 0x0040) >> 2 | (match_state & 0x7800) >> 11);
|
||||
/* Explicit
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_A)) ? XINPUT_GAMEPAD_A : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_B)) ? XINPUT_GAMEPAD_B : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_X)) ? XINPUT_GAMEPAD_X : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_Y)) ? XINPUT_GAMEPAD_Y : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_BACK)) ? XINPUT_GAMEPAD_BACK : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_START)) ? XINPUT_GAMEPAD_START : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_LEFTSTICK)) ? XINPUT_GAMEPAD_LEFT_THUMB : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_RIGHTSTICK)) ? XINPUT_GAMEPAD_RIGHT_THUMB: 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_LEFTSHOULDER)) ? XINPUT_GAMEPAD_LEFT_SHOULDER : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)) ? XINPUT_GAMEPAD_RIGHT_SHOULDER : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_UP)) ? XINPUT_GAMEPAD_DPAD_UP : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_DOWN)) ? XINPUT_GAMEPAD_DPAD_DOWN : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_LEFT)) ? XINPUT_GAMEPAD_DPAD_LEFT : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_RIGHT)) ? XINPUT_GAMEPAD_DPAD_RIGHT : 0);
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_A)) ? XINPUT_GAMEPAD_A : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_B)) ? XINPUT_GAMEPAD_B : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_X)) ? XINPUT_GAMEPAD_X : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_Y)) ? XINPUT_GAMEPAD_Y : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_BACK)) ? XINPUT_GAMEPAD_BACK : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_START)) ? XINPUT_GAMEPAD_START : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_LEFT_STICK)) ? XINPUT_GAMEPAD_LEFT_THUMB : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_RIGHT_STICK)) ? XINPUT_GAMEPAD_RIGHT_THUMB: 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_LEFT_SHOULDER)) ? XINPUT_GAMEPAD_LEFT_SHOULDER : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER)) ? XINPUT_GAMEPAD_RIGHT_SHOULDER : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_DPAD_UP)) ? XINPUT_GAMEPAD_DPAD_UP : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_DPAD_DOWN)) ? XINPUT_GAMEPAD_DPAD_DOWN : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_DPAD_LEFT)) ? XINPUT_GAMEPAD_DPAD_LEFT : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_DPAD_RIGHT)) ? XINPUT_GAMEPAD_DPAD_RIGHT : 0);
|
||||
*/
|
||||
|
||||
if (state->xinput_buttons) {
|
||||
@ -279,20 +279,20 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state
|
||||
/* RStick/LStick (QT) RShould/LShould (WV) DPad R/L/D/U YXBA bac(K) (S)tart */
|
||||
(match_state & 0x0180) << 5 | (match_state & 0x0600) << 1 | (match_state & 0x7800) >> 5 | (match_state & 0x000F) << 2 | (match_state & 0x0010) >> 3 | (match_state & 0x0040) >> 6;
|
||||
/* Explicit
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_A)) ? GamepadButtons_A : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_B)) ? GamepadButtons_B : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_X)) ? GamepadButtons_X : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_Y)) ? GamepadButtons_Y : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_BACK)) ? GamepadButtons_View : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_START)) ? GamepadButtons_Menu : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_LEFTSTICK)) ? GamepadButtons_LeftThumbstick : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_RIGHTSTICK)) ? GamepadButtons_RightThumbstick: 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_LEFTSHOULDER)) ? GamepadButtons_LeftShoulder: 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)) ? GamepadButtons_RightShoulder: 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_UP)) ? GamepadButtons_DPadUp : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_DOWN)) ? GamepadButtons_DPadDown : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_LEFT)) ? GamepadButtons_DPadLeft : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_RIGHT)) ? GamepadButtons_DPadRight : 0); */
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_A)) ? GamepadButtons_A : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_B)) ? GamepadButtons_B : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_X)) ? GamepadButtons_X : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_Y)) ? GamepadButtons_Y : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_BACK)) ? GamepadButtons_View : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_START)) ? GamepadButtons_Menu : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_LEFT_STICK)) ? GamepadButtons_LeftThumbstick : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_RIGHT_STICK)) ? GamepadButtons_RightThumbstick: 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_LEFT_SHOULDER)) ? GamepadButtons_LeftShoulder: 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER)) ? GamepadButtons_RightShoulder: 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_DPAD_UP)) ? GamepadButtons_DPadUp : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_DPAD_DOWN)) ? GamepadButtons_DPadDown : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_DPAD_LEFT)) ? GamepadButtons_DPadLeft : 0) |
|
||||
((match_state & (1<<SDL_GAMEPAD_BUTTON_DPAD_RIGHT)) ? GamepadButtons_DPadRight : 0); */
|
||||
|
||||
if (state->wgi_buttons) {
|
||||
state->any_data = SDL_TRUE;
|
||||
@ -1374,28 +1374,28 @@ static void RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT_MATCHING
|
||||
/* Map new buttons and axes into game controller controls */
|
||||
static const int button_map[] = {
|
||||
SDL_CONTROLLER_BUTTON_A,
|
||||
SDL_CONTROLLER_BUTTON_B,
|
||||
SDL_CONTROLLER_BUTTON_X,
|
||||
SDL_CONTROLLER_BUTTON_Y,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
|
||||
SDL_CONTROLLER_BUTTON_BACK,
|
||||
SDL_CONTROLLER_BUTTON_START,
|
||||
SDL_CONTROLLER_BUTTON_LEFTSTICK,
|
||||
SDL_CONTROLLER_BUTTON_RIGHTSTICK
|
||||
SDL_GAMEPAD_BUTTON_A,
|
||||
SDL_GAMEPAD_BUTTON_B,
|
||||
SDL_GAMEPAD_BUTTON_X,
|
||||
SDL_GAMEPAD_BUTTON_Y,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_BACK,
|
||||
SDL_GAMEPAD_BUTTON_START,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_STICK,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_STICK
|
||||
};
|
||||
#define HAT_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))
|
||||
#define HAT_MASK ((1 << SDL_GAMEPAD_BUTTON_DPAD_UP) | (1 << SDL_GAMEPAD_BUTTON_DPAD_DOWN) | (1 << SDL_GAMEPAD_BUTTON_DPAD_LEFT) | (1 << SDL_GAMEPAD_BUTTON_DPAD_RIGHT))
|
||||
static const int hat_map[] = {
|
||||
0,
|
||||
(1 << SDL_CONTROLLER_BUTTON_DPAD_UP),
|
||||
(1 << SDL_CONTROLLER_BUTTON_DPAD_UP) | (1 << SDL_CONTROLLER_BUTTON_DPAD_RIGHT),
|
||||
(1 << SDL_CONTROLLER_BUTTON_DPAD_RIGHT),
|
||||
(1 << SDL_CONTROLLER_BUTTON_DPAD_DOWN) | (1 << SDL_CONTROLLER_BUTTON_DPAD_RIGHT),
|
||||
(1 << SDL_CONTROLLER_BUTTON_DPAD_DOWN),
|
||||
(1 << SDL_CONTROLLER_BUTTON_DPAD_DOWN) | (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT),
|
||||
(1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT),
|
||||
(1 << SDL_CONTROLLER_BUTTON_DPAD_UP) | (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT),
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_UP),
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_UP) | (1 << SDL_GAMEPAD_BUTTON_DPAD_RIGHT),
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_RIGHT),
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_DOWN) | (1 << SDL_GAMEPAD_BUTTON_DPAD_RIGHT),
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_DOWN),
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_DOWN) | (1 << SDL_GAMEPAD_BUTTON_DPAD_LEFT),
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_LEFT),
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_UP) | (1 << SDL_GAMEPAD_BUTTON_DPAD_LEFT),
|
||||
};
|
||||
Uint64 match_state = ctx->match_state;
|
||||
/* Update match_state with button bit, then fall through */
|
||||
|
@ -1384,7 +1384,7 @@ static const char *DisplayOrientationName(int orientation)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *ControllerAxisName(const SDL_GameControllerAxis axis)
|
||||
static const char *ControllerAxisName(const SDL_GamepadAxis axis)
|
||||
{
|
||||
switch (axis) {
|
||||
#define AXIS_CASE(ax) \
|
||||
@ -1403,7 +1403,7 @@ static const char *ControllerAxisName(const SDL_GameControllerAxis axis)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *ControllerButtonName(const SDL_GameControllerButton button)
|
||||
static const char *ControllerButtonName(const SDL_GamepadButton button)
|
||||
{
|
||||
switch (button) {
|
||||
#define BUTTON_CASE(btn) \
|
||||
@ -1606,30 +1606,30 @@ static void SDLTest_PrintEvent(SDL_Event *event)
|
||||
SDL_Log("SDL EVENT: Joystick %" SDL_PRIs32 ": button %d released",
|
||||
event->jbutton.which, event->jbutton.button);
|
||||
break;
|
||||
case SDL_CONTROLLERDEVICEADDED:
|
||||
case SDL_GAMEPADADDED:
|
||||
SDL_Log("SDL EVENT: Controller index %" SDL_PRIs32 " attached",
|
||||
event->cdevice.which);
|
||||
break;
|
||||
case SDL_CONTROLLERDEVICEREMOVED:
|
||||
case SDL_GAMEPADREMOVED:
|
||||
SDL_Log("SDL EVENT: Controller %" SDL_PRIs32 " removed",
|
||||
event->cdevice.which);
|
||||
break;
|
||||
case SDL_CONTROLLERAXISMOTION:
|
||||
case SDL_GAMEPADAXISMOTION:
|
||||
SDL_Log("SDL EVENT: Controller %" SDL_PRIs32 " axis %d ('%s') value: %d",
|
||||
event->caxis.which,
|
||||
event->caxis.axis,
|
||||
ControllerAxisName((SDL_GameControllerAxis)event->caxis.axis),
|
||||
ControllerAxisName((SDL_GamepadAxis)event->caxis.axis),
|
||||
event->caxis.value);
|
||||
break;
|
||||
case SDL_CONTROLLERBUTTONDOWN:
|
||||
case SDL_GAMEPADBUTTONDOWN:
|
||||
SDL_Log("SDL EVENT: Controller %" SDL_PRIs32 "button %d ('%s') down",
|
||||
event->cbutton.which, event->cbutton.button,
|
||||
ControllerButtonName((SDL_GameControllerButton)event->cbutton.button));
|
||||
ControllerButtonName((SDL_GamepadButton)event->cbutton.button));
|
||||
break;
|
||||
case SDL_CONTROLLERBUTTONUP:
|
||||
case SDL_GAMEPADBUTTONUP:
|
||||
SDL_Log("SDL EVENT: Controller %" SDL_PRIs32 " button %d ('%s') up",
|
||||
event->cbutton.which, event->cbutton.button,
|
||||
ControllerButtonName((SDL_GameControllerButton)event->cbutton.button));
|
||||
ControllerButtonName((SDL_GamepadButton)event->cbutton.button));
|
||||
break;
|
||||
case SDL_CLIPBOARDUPDATE:
|
||||
SDL_Log("SDL EVENT: Clipboard updated");
|
||||
|
@ -135,7 +135,7 @@ if(LINUX AND TARGET sdl-build-options)
|
||||
endif()
|
||||
|
||||
add_sdl_test_executable(testfile testfile.c)
|
||||
add_sdl_test_executable(testgamecontroller NEEDS_RESOURCES TESTUTILS testgamecontroller.c)
|
||||
add_sdl_test_executable(testgamepad NEEDS_RESOURCES TESTUTILS testgamepad.c)
|
||||
add_sdl_test_executable(testgeometry TESTUTILS testgeometry.c)
|
||||
add_sdl_test_executable(testgl2 testgl2.c)
|
||||
add_sdl_test_executable(testgles testgles.c)
|
||||
@ -200,7 +200,7 @@ add_sdl_test_executable(testdisplayinfo testdisplayinfo.c)
|
||||
add_sdl_test_executable(testqsort NONINTERACTIVE testqsort.c)
|
||||
add_sdl_test_executable(testbounds testbounds.c)
|
||||
add_sdl_test_executable(testcustomcursor testcustomcursor.c)
|
||||
add_sdl_test_executable(controllermap NEEDS_RESOURCES TESTUTILS controllermap.c)
|
||||
add_sdl_test_executable(gamepadmap NEEDS_RESOURCES TESTUTILS gamepadmap.c)
|
||||
add_sdl_test_executable(testvulkan testvulkan.c)
|
||||
add_sdl_test_executable(testoffscreen testoffscreen.c)
|
||||
|
||||
|
@ -27,7 +27,7 @@ These are test programs for the SDL library:
|
||||
testver Check the version and dynamic loading and endianness
|
||||
testwm2 Test window manager -- title, icon, events
|
||||
torturethread Simple test for thread creation/destruction
|
||||
controllermap Useful to generate Game Controller API compatible maps
|
||||
gamepadmap Useful to generate Game Controller API compatible maps
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 160 KiB |
@ -10,7 +10,7 @@
|
||||
freely.
|
||||
*/
|
||||
|
||||
/* Game controller mapping generator */
|
||||
/* Gamepad mapping generator */
|
||||
/* Gabriel Jacobo <gabomdq@gmail.com> */
|
||||
|
||||
#include <stdio.h>
|
||||
@ -20,8 +20,8 @@
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include "testutils.h"
|
||||
|
||||
/* Define this for verbose output while mapping controllers */
|
||||
#define DEBUG_CONTROLLERMAP
|
||||
/* Define this for verbose output while mapping gamepads */
|
||||
#define DEBUG_GAMEPADMAP
|
||||
|
||||
#define SCREEN_WIDTH 512
|
||||
#define SCREEN_HEIGHT 320
|
||||
@ -34,20 +34,20 @@ enum marker_type
|
||||
|
||||
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,
|
||||
SDL_GAMEPAD_BINDING_AXIS_LEFTX_NEGATIVE,
|
||||
SDL_GAMEPAD_BINDING_AXIS_LEFTX_POSITIVE,
|
||||
SDL_GAMEPAD_BINDING_AXIS_LEFTY_NEGATIVE,
|
||||
SDL_GAMEPAD_BINDING_AXIS_LEFTY_POSITIVE,
|
||||
SDL_GAMEPAD_BINDING_AXIS_RIGHTX_NEGATIVE,
|
||||
SDL_GAMEPAD_BINDING_AXIS_RIGHTX_POSITIVE,
|
||||
SDL_GAMEPAD_BINDING_AXIS_RIGHTY_NEGATIVE,
|
||||
SDL_GAMEPAD_BINDING_AXIS_RIGHTY_POSITIVE,
|
||||
SDL_GAMEPAD_BINDING_AXIS_TRIGGERLEFT,
|
||||
SDL_GAMEPAD_BINDING_AXIS_TRIGGERRIGHT,
|
||||
SDL_GAMEPAD_BINDING_AXIS_MAX,
|
||||
};
|
||||
|
||||
#define BINDING_COUNT (SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_MAX)
|
||||
#define BINDING_COUNT (SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_MAX)
|
||||
|
||||
static struct
|
||||
{
|
||||
@ -56,78 +56,78 @@ static struct
|
||||
enum marker_type marker;
|
||||
|
||||
} s_arrBindingDisplay[] = {
|
||||
{ 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 */
|
||||
{ 232, 128, 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 */
|
||||
{ 232, 174, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_MISC1 */
|
||||
{ 132, 135, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_PADDLE1 */
|
||||
{ 330, 135, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_PADDLE2 */
|
||||
{ 132, 175, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_PADDLE3 */
|
||||
{ 330, 175, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_PADDLE4 */
|
||||
{ 0, 0, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_TOUCHPAD */
|
||||
{ 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 */
|
||||
{ 387, 167, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_A */
|
||||
{ 431, 132, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_B */
|
||||
{ 342, 132, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_X */
|
||||
{ 389, 101, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_Y */
|
||||
{ 174, 132, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_BACK */
|
||||
{ 232, 128, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_GUIDE */
|
||||
{ 289, 132, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_START */
|
||||
{ 75, 154, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_LEFT_STICK */
|
||||
{ 305, 230, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_RIGHT_STICK */
|
||||
{ 77, 40, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_LEFT_SHOULDER */
|
||||
{ 396, 36, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER */
|
||||
{ 154, 188, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_DPAD_UP */
|
||||
{ 154, 249, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_DPAD_DOWN */
|
||||
{ 116, 217, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */
|
||||
{ 186, 217, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_DPAD_RIGHT */
|
||||
{ 232, 174, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_MISC1 */
|
||||
{ 132, 135, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_PADDLE1 */
|
||||
{ 330, 135, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_PADDLE2 */
|
||||
{ 132, 175, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_PADDLE3 */
|
||||
{ 330, 175, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_PADDLE4 */
|
||||
{ 0, 0, 0.0, MARKER_BUTTON }, /* SDL_GAMEPAD_BUTTON_TOUCHPAD */
|
||||
{ 74, 153, 270.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_LEFTX_NEGATIVE */
|
||||
{ 74, 153, 90.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_LEFTX_POSITIVE */
|
||||
{ 74, 153, 0.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_LEFTY_NEGATIVE */
|
||||
{ 74, 153, 180.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_LEFTY_POSITIVE */
|
||||
{ 306, 231, 270.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_RIGHTX_NEGATIVE */
|
||||
{ 306, 231, 90.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_RIGHTX_POSITIVE */
|
||||
{ 306, 231, 0.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_RIGHTY_NEGATIVE */
|
||||
{ 306, 231, 180.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_RIGHTY_POSITIVE */
|
||||
{ 91, -20, 180.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_TRIGGERLEFT */
|
||||
{ 375, -20, 180.0, MARKER_AXIS }, /* SDL_GAMEPAD_BINDING_AXIS_TRIGGERRIGHT */
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT(s_arrBindingDisplay, SDL_arraysize(s_arrBindingDisplay) == BINDING_COUNT);
|
||||
|
||||
static int s_arrBindingOrder[] = {
|
||||
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,
|
||||
SDL_CONTROLLER_BUTTON_MISC1,
|
||||
SDL_CONTROLLER_BUTTON_PADDLE1,
|
||||
SDL_CONTROLLER_BUTTON_PADDLE2,
|
||||
SDL_CONTROLLER_BUTTON_PADDLE3,
|
||||
SDL_CONTROLLER_BUTTON_PADDLE4,
|
||||
SDL_CONTROLLER_BUTTON_TOUCHPAD,
|
||||
SDL_GAMEPAD_BUTTON_A,
|
||||
SDL_GAMEPAD_BUTTON_B,
|
||||
SDL_GAMEPAD_BUTTON_Y,
|
||||
SDL_GAMEPAD_BUTTON_X,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_LEFTX_NEGATIVE,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_LEFTX_POSITIVE,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_LEFTY_NEGATIVE,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_LEFTY_POSITIVE,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_STICK,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_RIGHTX_NEGATIVE,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_RIGHTX_POSITIVE,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_RIGHTY_NEGATIVE,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_RIGHTY_POSITIVE,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_STICK,
|
||||
SDL_GAMEPAD_BUTTON_LEFT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_TRIGGERLEFT,
|
||||
SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER,
|
||||
SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_TRIGGERRIGHT,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_UP,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_RIGHT,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_DOWN,
|
||||
SDL_GAMEPAD_BUTTON_DPAD_LEFT,
|
||||
SDL_GAMEPAD_BUTTON_BACK,
|
||||
SDL_GAMEPAD_BUTTON_GUIDE,
|
||||
SDL_GAMEPAD_BUTTON_START,
|
||||
SDL_GAMEPAD_BUTTON_MISC1,
|
||||
SDL_GAMEPAD_BUTTON_PADDLE1,
|
||||
SDL_GAMEPAD_BUTTON_PADDLE2,
|
||||
SDL_GAMEPAD_BUTTON_PADDLE3,
|
||||
SDL_GAMEPAD_BUTTON_PADDLE4,
|
||||
SDL_GAMEPAD_BUTTON_TOUCHPAD,
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT(s_arrBindingOrder, SDL_arraysize(s_arrBindingOrder) == BINDING_COUNT);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_GameControllerBindType bindType;
|
||||
SDL_GamepadBindingType bindType;
|
||||
union
|
||||
{
|
||||
int button;
|
||||
@ -205,7 +205,7 @@ SetCurrentBinding(int iBinding)
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_arrBindingOrder[iBinding] == SDL_CONTROLLER_BUTTON_TOUCHPAD &&
|
||||
if (s_arrBindingOrder[iBinding] == SDL_GAMEPAD_BUTTON_TOUCHPAD &&
|
||||
!bind_touchpad) {
|
||||
SetCurrentBinding(iBinding + 1);
|
||||
return;
|
||||
@ -230,7 +230,7 @@ BBindingContainsBinding(const SDL_GameControllerExtendedBind *pBindingA, const S
|
||||
return SDL_FALSE;
|
||||
}
|
||||
switch (pBindingA->bindType) {
|
||||
case SDL_CONTROLLER_BINDTYPE_AXIS:
|
||||
case SDL_GAMEPAD_BINDTYPE_AXIS:
|
||||
if (pBindingA->value.axis.axis != pBindingB->value.axis.axis) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
@ -261,13 +261,13 @@ ConfigureBinding(const SDL_GameControllerExtendedBind *pBinding)
|
||||
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) {
|
||||
if (iIndex == SDL_GAMEPAD_BUTTON_A && iCurrentElement != SDL_GAMEPAD_BUTTON_B) {
|
||||
/* Skip to the next binding */
|
||||
SetCurrentBinding(s_iCurrentBinding + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (iIndex == SDL_CONTROLLER_BUTTON_B) {
|
||||
if (iIndex == SDL_GAMEPAD_BUTTON_B) {
|
||||
/* Go back to the previous binding */
|
||||
SetCurrentBinding(s_iCurrentBinding - 1);
|
||||
return;
|
||||
@ -278,42 +278,42 @@ ConfigureBinding(const SDL_GameControllerExtendedBind *pBinding)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CONTROLLERMAP
|
||||
#ifdef DEBUG_GAMEPADMAP
|
||||
switch (pBinding->bindType) {
|
||||
case SDL_CONTROLLER_BINDTYPE_NONE:
|
||||
case SDL_GAMEPAD_BINDTYPE_NONE:
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDTYPE_BUTTON:
|
||||
case SDL_GAMEPAD_BINDTYPE_BUTTON:
|
||||
SDL_Log("Configuring button binding for button %d\n", pBinding->value.button);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDTYPE_AXIS:
|
||||
case SDL_GAMEPAD_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:
|
||||
case SDL_GAMEPAD_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 */
|
||||
#endif /* DEBUG_GAMEPADMAP */
|
||||
|
||||
/* Should the new binding override the existing one? */
|
||||
pCurrent = &s_arrBindings[iCurrentElement];
|
||||
if (pCurrent->bindType != SDL_CONTROLLER_BINDTYPE_NONE) {
|
||||
if (pCurrent->bindType != SDL_GAMEPAD_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);
|
||||
bNativeDPad = (iCurrentElement == SDL_GAMEPAD_BUTTON_DPAD_UP ||
|
||||
iCurrentElement == SDL_GAMEPAD_BUTTON_DPAD_DOWN ||
|
||||
iCurrentElement == SDL_GAMEPAD_BUTTON_DPAD_LEFT ||
|
||||
iCurrentElement == SDL_GAMEPAD_BUTTON_DPAD_RIGHT);
|
||||
bCurrentDPad = (pCurrent->bindType == SDL_GAMEPAD_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);
|
||||
bNativeAxis = (iCurrentElement >= SDL_GAMEPAD_BUTTON_MAX);
|
||||
bCurrentAxis = (pCurrent->bindType == SDL_GAMEPAD_BINDTYPE_AXIS);
|
||||
if (bNativeAxis == bCurrentAxis &&
|
||||
(pBinding->bindType != SDL_CONTROLLER_BINDTYPE_AXIS ||
|
||||
(pBinding->bindType != SDL_GAMEPAD_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;
|
||||
@ -334,13 +334,13 @@ 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 &&
|
||||
if (pBindingA->bindType == SDL_GAMEPAD_BINDTYPE_AXIS &&
|
||||
pBindingB->bindType == SDL_GAMEPAD_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;
|
||||
pBindingB->bindType = SDL_GAMEPAD_BINDTYPE_NONE;
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
@ -358,8 +358,8 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
Uint64 alpha_ticks = 0;
|
||||
SDL_JoystickID nJoystickID;
|
||||
|
||||
background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE, NULL, NULL);
|
||||
background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE, NULL, NULL);
|
||||
background_front = LoadTexture(screen, "gamepadmap.bmp", SDL_FALSE, NULL, NULL);
|
||||
background_back = LoadTexture(screen, "gamepadmap_back.bmp", SDL_FALSE, NULL, NULL);
|
||||
button = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL);
|
||||
axis = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL);
|
||||
SDL_RaiseWindow(window);
|
||||
@ -376,8 +376,8 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
|
||||
SDL_Log("\n\n\
|
||||
====================================================================================\n\
|
||||
Press the buttons on your controller when indicated\n\
|
||||
(Your controller may look different than the picture)\n\
|
||||
Press the buttons on your gamepad when indicated\n\
|
||||
(Your gamepad 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\
|
||||
@ -422,8 +422,8 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
|
||||
SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderClear(screen);
|
||||
if (s_arrBindingOrder[s_iCurrentBinding] >= SDL_CONTROLLER_BUTTON_PADDLE1 &&
|
||||
s_arrBindingOrder[s_iCurrentBinding] <= SDL_CONTROLLER_BUTTON_PADDLE4) {
|
||||
if (s_arrBindingOrder[s_iCurrentBinding] >= SDL_GAMEPAD_BUTTON_PADDLE1 &&
|
||||
s_arrBindingOrder[s_iCurrentBinding] <= SDL_GAMEPAD_BUTTON_PADDLE4) {
|
||||
SDL_RenderTexture(screen, background_back, NULL, NULL);
|
||||
} else {
|
||||
SDL_RenderTexture(screen, background_front, NULL, NULL);
|
||||
@ -442,7 +442,7 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
break;
|
||||
case SDL_JOYAXISMOTION:
|
||||
if (event.jaxis.which == nJoystickID) {
|
||||
const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */
|
||||
const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 gamepad needed 96 */
|
||||
AxisState *pAxisState = &s_arrAxisState[event.jaxis.axis];
|
||||
int nValue = event.jaxis.value;
|
||||
int nCurrentDistance, nFarthestDistance;
|
||||
@ -464,7 +464,7 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CONTROLLERMAP
|
||||
#ifdef DEBUG_GAMEPADMAP
|
||||
SDL_Log("AXIS %d nValue %d nCurrentDistance %d nFarthestDistance %d\n", event.jaxis.axis, nValue, nCurrentDistance, nFarthestDistance);
|
||||
#endif
|
||||
if (nFarthestDistance >= 16000) {
|
||||
@ -472,7 +472,7 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
SDL_bool bCommitBinding = (nCurrentDistance <= 10000) ? SDL_TRUE : SDL_FALSE;
|
||||
SDL_GameControllerExtendedBind binding;
|
||||
SDL_zero(binding);
|
||||
binding.bindType = SDL_CONTROLLER_BINDTYPE_AXIS;
|
||||
binding.bindType = SDL_GAMEPAD_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);
|
||||
@ -486,11 +486,11 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
if (event.jhat.value != SDL_HAT_CENTERED) {
|
||||
SDL_GameControllerExtendedBind binding;
|
||||
|
||||
#ifdef DEBUG_CONTROLLERMAP
|
||||
#ifdef DEBUG_GAMEPADMAP
|
||||
SDL_Log("HAT %d %d\n", event.jhat.hat, event.jhat.value);
|
||||
#endif
|
||||
SDL_zero(binding);
|
||||
binding.bindType = SDL_CONTROLLER_BINDTYPE_HAT;
|
||||
binding.bindType = SDL_GAMEPAD_BINDTYPE_HAT;
|
||||
binding.value.hat.hat = event.jhat.hat;
|
||||
binding.value.hat.hat_mask = event.jhat.value;
|
||||
binding.committed = SDL_TRUE;
|
||||
@ -502,11 +502,11 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
if (event.jbutton.which == nJoystickID) {
|
||||
SDL_GameControllerExtendedBind binding;
|
||||
|
||||
#ifdef DEBUG_CONTROLLERMAP
|
||||
#ifdef DEBUG_GAMEPADMAP
|
||||
SDL_Log("BUTTON %d\n", event.jbutton.button);
|
||||
#endif
|
||||
SDL_zero(binding);
|
||||
binding.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON;
|
||||
binding.bindType = SDL_GAMEPAD_BINDTYPE_BUTTON;
|
||||
binding.value.button = event.jbutton.button;
|
||||
binding.committed = SDL_TRUE;
|
||||
ConfigureBinding(&binding);
|
||||
@ -542,7 +542,7 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
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)
|
||||
in case a gamepad 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);
|
||||
@ -595,61 +595,61 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
|
||||
for (iIndex = 0; iIndex < SDL_arraysize(s_arrBindings); ++iIndex) {
|
||||
SDL_GameControllerExtendedBind *pBinding = &s_arrBindings[iIndex];
|
||||
if (pBinding->bindType == SDL_CONTROLLER_BINDTYPE_NONE) {
|
||||
if (pBinding->bindType == SDL_GAMEPAD_BINDTYPE_NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (iIndex < SDL_CONTROLLER_BUTTON_MAX) {
|
||||
SDL_GameControllerButton eButton = (SDL_GameControllerButton)iIndex;
|
||||
SDL_strlcat(mapping, SDL_GameControllerGetStringForButton(eButton), SDL_arraysize(mapping));
|
||||
if (iIndex < SDL_GAMEPAD_BUTTON_MAX) {
|
||||
SDL_GamepadButton eButton = (SDL_GamepadButton)iIndex;
|
||||
SDL_strlcat(mapping, SDL_GetGamepadStringForButton(eButton), SDL_arraysize(mapping));
|
||||
} else {
|
||||
const char *pszAxisName = NULL;
|
||||
switch (iIndex - SDL_CONTROLLER_BUTTON_MAX) {
|
||||
case SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE:
|
||||
switch (iIndex - SDL_GAMEPAD_BUTTON_MAX) {
|
||||
case SDL_GAMEPAD_BINDING_AXIS_LEFTX_NEGATIVE:
|
||||
if (!BMergeAxisBindings(iIndex)) {
|
||||
SDL_strlcat(mapping, "-", SDL_arraysize(mapping));
|
||||
}
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTX);
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_LEFTX);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE:
|
||||
case SDL_GAMEPAD_BINDING_AXIS_LEFTX_POSITIVE:
|
||||
SDL_strlcat(mapping, "+", SDL_arraysize(mapping));
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTX);
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_LEFTX);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE:
|
||||
case SDL_GAMEPAD_BINDING_AXIS_LEFTY_NEGATIVE:
|
||||
if (!BMergeAxisBindings(iIndex)) {
|
||||
SDL_strlcat(mapping, "-", SDL_arraysize(mapping));
|
||||
}
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTY);
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_LEFTY);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE:
|
||||
case SDL_GAMEPAD_BINDING_AXIS_LEFTY_POSITIVE:
|
||||
SDL_strlcat(mapping, "+", SDL_arraysize(mapping));
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTY);
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_LEFTY);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE:
|
||||
case SDL_GAMEPAD_BINDING_AXIS_RIGHTX_NEGATIVE:
|
||||
if (!BMergeAxisBindings(iIndex)) {
|
||||
SDL_strlcat(mapping, "-", SDL_arraysize(mapping));
|
||||
}
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTX);
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_RIGHTX);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE:
|
||||
case SDL_GAMEPAD_BINDING_AXIS_RIGHTX_POSITIVE:
|
||||
SDL_strlcat(mapping, "+", SDL_arraysize(mapping));
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTX);
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_RIGHTX);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE:
|
||||
case SDL_GAMEPAD_BINDING_AXIS_RIGHTY_NEGATIVE:
|
||||
if (!BMergeAxisBindings(iIndex)) {
|
||||
SDL_strlcat(mapping, "-", SDL_arraysize(mapping));
|
||||
}
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTY);
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_RIGHTY);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE:
|
||||
case SDL_GAMEPAD_BINDING_AXIS_RIGHTY_POSITIVE:
|
||||
SDL_strlcat(mapping, "+", SDL_arraysize(mapping));
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTY);
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_RIGHTY);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT:
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERLEFT);
|
||||
case SDL_GAMEPAD_BINDING_AXIS_TRIGGERLEFT:
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_LEFT_TRIGGER);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT:
|
||||
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT);
|
||||
case SDL_GAMEPAD_BINDING_AXIS_TRIGGERRIGHT:
|
||||
pszAxisName = SDL_GetGamepadStringForAxis(SDL_GAMEPAD_AXIS_RIGHT_TRIGGER);
|
||||
break;
|
||||
}
|
||||
if (pszAxisName) {
|
||||
@ -660,10 +660,10 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
|
||||
pszElement[0] = '\0';
|
||||
switch (pBinding->bindType) {
|
||||
case SDL_CONTROLLER_BINDTYPE_BUTTON:
|
||||
case SDL_GAMEPAD_BINDTYPE_BUTTON:
|
||||
(void)SDL_snprintf(pszElement, sizeof pszElement, "b%d", pBinding->value.button);
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDTYPE_AXIS:
|
||||
case SDL_GAMEPAD_BINDTYPE_AXIS:
|
||||
if (pBinding->value.axis.axis_min == 0 && pBinding->value.axis.axis_max == SDL_JOYSTICK_AXIS_MIN) {
|
||||
/* The negative half axis */
|
||||
(void)SDL_snprintf(pszElement, sizeof pszElement, "-a%d", pBinding->value.axis.axis);
|
||||
@ -678,7 +678,7 @@ WatchJoystick(SDL_Joystick *joystick)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDL_CONTROLLER_BINDTYPE_HAT:
|
||||
case SDL_GAMEPAD_BINDTYPE_HAT:
|
||||
(void)SDL_snprintf(pszElement, sizeof pszElement, "h%d.%d", pBinding->value.hat.hat, pBinding->value.hat.hat_mask);
|
||||
break;
|
||||
default:
|
Before Width: | Height: | Size: 476 KiB After Width: | Height: | Size: 476 KiB |
@ -22,13 +22,13 @@ TestVirtualJoystick(void *arg)
|
||||
SDL_Joystick *joystick = NULL;
|
||||
int device_index;
|
||||
|
||||
SDLTest_AssertCheck(SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)");
|
||||
SDLTest_AssertCheck(SDL_InitSubSystem(SDL_INIT_GAMEPAD) == 0, "SDL_InitSubSystem(SDL_INIT_GAMEPAD)");
|
||||
|
||||
SDL_zero(desc);
|
||||
desc.version = SDL_VIRTUAL_JOYSTICK_DESC_VERSION;
|
||||
desc.type = SDL_JOYSTICK_TYPE_GAMECONTROLLER;
|
||||
desc.naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
desc.nbuttons = SDL_CONTROLLER_BUTTON_MAX;
|
||||
desc.naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
desc.nbuttons = SDL_GAMEPAD_BUTTON_MAX;
|
||||
desc.vendor_id = USB_VENDOR_NVIDIA;
|
||||
desc.product_id = USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V104;
|
||||
desc.name = "Virtual NVIDIA SHIELD Controller";
|
||||
@ -50,12 +50,12 @@ TestVirtualJoystick(void *arg)
|
||||
SDLTest_AssertCheck(SDL_GetNumJoystickHats(joystick) == desc.nhats, "SDL_GetNumJoystickHats()");
|
||||
SDLTest_AssertCheck(SDL_GetNumJoystickButtons(joystick) == desc.nbuttons, "SDL_GetNumJoystickButtons()");
|
||||
|
||||
SDLTest_AssertCheck(SDL_SetJoystickVirtualButton(joystick, SDL_CONTROLLER_BUTTON_A, SDL_PRESSED) == 0, "SDL_SetJoystickVirtualButton(SDL_CONTROLLER_BUTTON_A, SDL_PRESSED)");
|
||||
SDLTest_AssertCheck(SDL_SetJoystickVirtualButton(joystick, SDL_GAMEPAD_BUTTON_A, SDL_PRESSED) == 0, "SDL_SetJoystickVirtualButton(SDL_GAMEPAD_BUTTON_A, SDL_PRESSED)");
|
||||
SDL_UpdateJoysticks();
|
||||
SDLTest_AssertCheck(SDL_GetJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A) == SDL_PRESSED, "SDL_GetJoystickButton(SDL_CONTROLLER_BUTTON_A) == SDL_PRESSED");
|
||||
SDLTest_AssertCheck(SDL_SetJoystickVirtualButton(joystick, SDL_CONTROLLER_BUTTON_A, SDL_RELEASED) == 0, "SDL_SetJoystickVirtualButton(SDL_CONTROLLER_BUTTON_A, SDL_RELEASED)");
|
||||
SDLTest_AssertCheck(SDL_GetJoystickButton(joystick, SDL_GAMEPAD_BUTTON_A) == SDL_PRESSED, "SDL_GetJoystickButton(SDL_GAMEPAD_BUTTON_A) == SDL_PRESSED");
|
||||
SDLTest_AssertCheck(SDL_SetJoystickVirtualButton(joystick, SDL_GAMEPAD_BUTTON_A, SDL_RELEASED) == 0, "SDL_SetJoystickVirtualButton(SDL_GAMEPAD_BUTTON_A, SDL_RELEASED)");
|
||||
SDL_UpdateJoysticks();
|
||||
SDLTest_AssertCheck(SDL_GetJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A) == SDL_RELEASED, "SDL_GetJoystickButton(SDL_CONTROLLER_BUTTON_A) == SDL_RELEASED");
|
||||
SDLTest_AssertCheck(SDL_GetJoystickButton(joystick, SDL_GAMEPAD_BUTTON_A) == SDL_RELEASED, "SDL_GetJoystickButton(SDL_GAMEPAD_BUTTON_A) == SDL_RELEASED");
|
||||
|
||||
SDL_CloseJoystick(joystick);
|
||||
}
|
||||
@ -63,7 +63,7 @@ TestVirtualJoystick(void *arg)
|
||||
}
|
||||
SDLTest_AssertCheck(!SDL_IsJoystickVirtual(device_index), "!SDL_IsJoystickVirtual()");
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMEPAD);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ static int main_testInitQuitJoystickHaptic(void *arg)
|
||||
static int main_testInitQuitSubSystem(void *arg)
|
||||
{
|
||||
int i;
|
||||
int subsystems[] = { SDL_INIT_JOYSTICK, SDL_INIT_HAPTIC, SDL_INIT_GAMECONTROLLER };
|
||||
int subsystems[] = { SDL_INIT_JOYSTICK, SDL_INIT_HAPTIC, SDL_INIT_GAMEPAD };
|
||||
|
||||
for (i = 0; i < SDL_arraysize(subsystems); ++i) {
|
||||
int initialized_system;
|
||||
@ -62,14 +62,14 @@ static int main_testInitQuitSubSystem(void *arg)
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
const int joy_and_controller = SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER;
|
||||
const int joy_and_controller = SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD;
|
||||
static int main_testImpliedJoystickInit(void *arg)
|
||||
{
|
||||
int initialized_system;
|
||||
|
||||
/* First initialize the controller */
|
||||
SDLTest_AssertCheck((SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller");
|
||||
SDLTest_AssertCheck(SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)");
|
||||
SDLTest_AssertCheck(SDL_InitSubSystem(SDL_INIT_GAMEPAD) == 0, "SDL_InitSubSystem(SDL_INIT_GAMEPAD)");
|
||||
|
||||
/* Then make sure this implicitly initialized the joystick subsystem */
|
||||
initialized_system = SDL_WasInit(joy_and_controller);
|
||||
@ -77,7 +77,7 @@ static int main_testImpliedJoystickInit(void *arg)
|
||||
|
||||
/* Then quit the controller, and make sure that implicitly also quits the */
|
||||
/* joystick subsystem */
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMEPAD);
|
||||
initialized_system = SDL_WasInit(joy_and_controller);
|
||||
SDLTest_AssertCheck((initialized_system & joy_and_controller) == 0, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system);
|
||||
|
||||
@ -91,7 +91,7 @@ static int main_testImpliedJoystickQuit(void *arg)
|
||||
/* First initialize the controller and the joystick (explicitly) */
|
||||
SDLTest_AssertCheck((SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller");
|
||||
SDLTest_AssertCheck(SDL_InitSubSystem(SDL_INIT_JOYSTICK) == 0, "SDL_InitSubSystem(SDL_INIT_JOYSTICK)");
|
||||
SDLTest_AssertCheck(SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)");
|
||||
SDLTest_AssertCheck(SDL_InitSubSystem(SDL_INIT_GAMEPAD) == 0, "SDL_InitSubSystem(SDL_INIT_GAMEPAD)");
|
||||
|
||||
/* Then make sure they're both initialized properly */
|
||||
initialized_system = SDL_WasInit(joy_and_controller);
|
||||
@ -99,7 +99,7 @@ static int main_testImpliedJoystickQuit(void *arg)
|
||||
|
||||
/* Then quit the controller, and make sure that it does NOT quit the */
|
||||
/* explicitly initialized joystick subsystem. */
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMEPAD);
|
||||
initialized_system = SDL_WasInit(joy_and_controller);
|
||||
SDLTest_AssertCheck((initialized_system & joy_and_controller) == SDL_INIT_JOYSTICK, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system);
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
freely.
|
||||
*/
|
||||
|
||||
/* Simple program to test the SDL game controller routines */
|
||||
/* Simple program to test the SDL gamepad routines */
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
@ -26,37 +26,37 @@
|
||||
#define BUTTON_SIZE 50
|
||||
#define AXIS_SIZE 50
|
||||
|
||||
/* This is indexed by SDL_GameControllerButton. */
|
||||
/* This is indexed by SDL_GamepadButton. */
|
||||
static const struct
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
} button_positions[] = {
|
||||
{ 387, 167 }, /* SDL_CONTROLLER_BUTTON_A */
|
||||
{ 431, 132 }, /* SDL_CONTROLLER_BUTTON_B */
|
||||
{ 342, 132 }, /* SDL_CONTROLLER_BUTTON_X */
|
||||
{ 389, 101 }, /* SDL_CONTROLLER_BUTTON_Y */
|
||||
{ 174, 132 }, /* SDL_CONTROLLER_BUTTON_BACK */
|
||||
{ 232, 128 }, /* SDL_CONTROLLER_BUTTON_GUIDE */
|
||||
{ 289, 132 }, /* SDL_CONTROLLER_BUTTON_START */
|
||||
{ 75, 154 }, /* SDL_CONTROLLER_BUTTON_LEFTSTICK */
|
||||
{ 305, 230 }, /* SDL_CONTROLLER_BUTTON_RIGHTSTICK */
|
||||
{ 77, 40 }, /* SDL_CONTROLLER_BUTTON_LEFTSHOULDER */
|
||||
{ 396, 36 }, /* SDL_CONTROLLER_BUTTON_RIGHTSHOULDER */
|
||||
{ 154, 188 }, /* SDL_CONTROLLER_BUTTON_DPAD_UP */
|
||||
{ 154, 249 }, /* SDL_CONTROLLER_BUTTON_DPAD_DOWN */
|
||||
{ 116, 217 }, /* SDL_CONTROLLER_BUTTON_DPAD_LEFT */
|
||||
{ 186, 217 }, /* SDL_CONTROLLER_BUTTON_DPAD_RIGHT */
|
||||
{ 232, 174 }, /* SDL_CONTROLLER_BUTTON_MISC1 */
|
||||
{ 132, 135 }, /* SDL_CONTROLLER_BUTTON_PADDLE1 */
|
||||
{ 330, 135 }, /* SDL_CONTROLLER_BUTTON_PADDLE2 */
|
||||
{ 132, 175 }, /* SDL_CONTROLLER_BUTTON_PADDLE3 */
|
||||
{ 330, 175 }, /* SDL_CONTROLLER_BUTTON_PADDLE4 */
|
||||
{ 0, 0 }, /* SDL_CONTROLLER_BUTTON_TOUCHPAD */
|
||||
{ 387, 167 }, /* SDL_GAMEPAD_BUTTON_A */
|
||||
{ 431, 132 }, /* SDL_GAMEPAD_BUTTON_B */
|
||||
{ 342, 132 }, /* SDL_GAMEPAD_BUTTON_X */
|
||||
{ 389, 101 }, /* SDL_GAMEPAD_BUTTON_Y */
|
||||
{ 174, 132 }, /* SDL_GAMEPAD_BUTTON_BACK */
|
||||
{ 232, 128 }, /* SDL_GAMEPAD_BUTTON_GUIDE */
|
||||
{ 289, 132 }, /* SDL_GAMEPAD_BUTTON_START */
|
||||
{ 75, 154 }, /* SDL_GAMEPAD_BUTTON_LEFT_STICK */
|
||||
{ 305, 230 }, /* SDL_GAMEPAD_BUTTON_RIGHT_STICK */
|
||||
{ 77, 40 }, /* SDL_GAMEPAD_BUTTON_LEFT_SHOULDER */
|
||||
{ 396, 36 }, /* SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER */
|
||||
{ 154, 188 }, /* SDL_GAMEPAD_BUTTON_DPAD_UP */
|
||||
{ 154, 249 }, /* SDL_GAMEPAD_BUTTON_DPAD_DOWN */
|
||||
{ 116, 217 }, /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */
|
||||
{ 186, 217 }, /* SDL_GAMEPAD_BUTTON_DPAD_RIGHT */
|
||||
{ 232, 174 }, /* SDL_GAMEPAD_BUTTON_MISC1 */
|
||||
{ 132, 135 }, /* SDL_GAMEPAD_BUTTON_PADDLE1 */
|
||||
{ 330, 135 }, /* SDL_GAMEPAD_BUTTON_PADDLE2 */
|
||||
{ 132, 175 }, /* SDL_GAMEPAD_BUTTON_PADDLE3 */
|
||||
{ 330, 175 }, /* SDL_GAMEPAD_BUTTON_PADDLE4 */
|
||||
{ 0, 0 }, /* SDL_GAMEPAD_BUTTON_TOUCHPAD */
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT(button_positions, SDL_arraysize(button_positions) == SDL_CONTROLLER_BUTTON_MAX);
|
||||
SDL_COMPILE_TIME_ASSERT(button_positions, SDL_arraysize(button_positions) == SDL_GAMEPAD_BUTTON_MAX);
|
||||
|
||||
/* This is indexed by SDL_GameControllerAxis. */
|
||||
/* This is indexed by SDL_GamepadAxis. */
|
||||
static const struct
|
||||
{
|
||||
int x;
|
||||
@ -70,7 +70,7 @@ static const struct
|
||||
{ 91, -20, 0.0 }, /* TRIGGERLEFT */
|
||||
{ 375, -20, 0.0 }, /* TRIGGERRIGHT */
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT(axis_positions, SDL_arraysize(axis_positions) == SDL_CONTROLLER_AXIS_MAX);
|
||||
SDL_COMPILE_TIME_ASSERT(axis_positions, SDL_arraysize(axis_positions) == SDL_GAMEPAD_AXIS_MAX);
|
||||
|
||||
/* This is indexed by SDL_JoystickPowerLevel + 1. */
|
||||
static const char *power_level_strings[] = {
|
||||
@ -90,14 +90,14 @@ static SDL_bool done = SDL_FALSE;
|
||||
static SDL_bool set_LED = SDL_FALSE;
|
||||
static int trigger_effect = 0;
|
||||
static SDL_Texture *background_front, *background_back, *button_texture, *axis_texture;
|
||||
static SDL_GameController *gamecontroller;
|
||||
static SDL_GameController **gamecontrollers;
|
||||
static int num_controllers = 0;
|
||||
static SDL_Gamepad *gamepad;
|
||||
static SDL_Gamepad **gamepads;
|
||||
static int num_gamepads = 0;
|
||||
static SDL_Joystick *virtual_joystick = NULL;
|
||||
static SDL_GameControllerAxis virtual_axis_active = SDL_CONTROLLER_AXIS_INVALID;
|
||||
static SDL_GamepadAxis virtual_axis_active = SDL_GAMEPAD_AXIS_INVALID;
|
||||
static int virtual_axis_start_x;
|
||||
static int virtual_axis_start_y;
|
||||
static SDL_GameControllerButton virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID;
|
||||
static SDL_GamepadButton virtual_button_active = SDL_GAMEPAD_BUTTON_INVALID;
|
||||
|
||||
static void UpdateWindowTitle()
|
||||
{
|
||||
@ -105,10 +105,10 @@ static void UpdateWindowTitle()
|
||||
return;
|
||||
}
|
||||
|
||||
if (gamecontroller) {
|
||||
const char *name = SDL_GameControllerName(gamecontroller);
|
||||
const char *serial = SDL_GameControllerGetSerial(gamecontroller);
|
||||
const char *basetitle = "Game Controller Test: ";
|
||||
if (gamepad) {
|
||||
const char *name = SDL_GetGamepadName(gamepad);
|
||||
const char *serial = SDL_GetGamepadSerial(gamepad);
|
||||
const char *basetitle = "Gamepad Test: ";
|
||||
const size_t titlelen = SDL_strlen(basetitle) + (name ? SDL_strlen(name) : 0) + (serial ? 3 + SDL_strlen(serial) : 0) + 1;
|
||||
char *title = (char *)SDL_malloc(titlelen);
|
||||
|
||||
@ -129,7 +129,7 @@ static void UpdateWindowTitle()
|
||||
SDL_free(title);
|
||||
}
|
||||
} else {
|
||||
SDL_SetWindowTitle(window, "Waiting for controller...");
|
||||
SDL_SetWindowTitle(window, "Waiting for gamepad...");
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,23 +153,23 @@ static const char *GetSensorName(SDL_SensorType sensor)
|
||||
}
|
||||
}
|
||||
|
||||
static int FindController(SDL_JoystickID controller_id)
|
||||
static int FindGamepad(SDL_JoystickID gamepad_id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_controllers; ++i) {
|
||||
if (controller_id == SDL_GetJoystickInstanceID(SDL_GameControllerGetJoystick(gamecontrollers[i]))) {
|
||||
for (i = 0; i < num_gamepads; ++i) {
|
||||
if (gamepad_id == SDL_GetJoystickInstanceID(SDL_GetGamepadJoystick(gamepads[i]))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void AddController(int device_index, SDL_bool verbose)
|
||||
static void AddGamepad(int device_index, SDL_bool verbose)
|
||||
{
|
||||
SDL_JoystickID controller_id = SDL_GetJoystickDeviceInstanceID(device_index);
|
||||
SDL_GameController *controller;
|
||||
SDL_GameController **controllers;
|
||||
SDL_JoystickID gamepad_id = SDL_GetJoystickDeviceInstanceID(device_index);
|
||||
SDL_Gamepad **new_gamepads;
|
||||
SDL_Gamepad *new_gamepad;
|
||||
Uint16 firmware_version;
|
||||
SDL_SensorType sensors[] = {
|
||||
SDL_SENSOR_ACCEL,
|
||||
@ -181,41 +181,41 @@ static void AddController(int device_index, SDL_bool verbose)
|
||||
};
|
||||
unsigned int i;
|
||||
|
||||
controller_id = SDL_GetJoystickDeviceInstanceID(device_index);
|
||||
if (controller_id < 0) {
|
||||
SDL_Log("Couldn't get controller ID: %s\n", SDL_GetError());
|
||||
gamepad_id = SDL_GetJoystickDeviceInstanceID(device_index);
|
||||
if (gamepad_id < 0) {
|
||||
SDL_Log("Couldn't get gamepad ID: %s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
if (FindController(controller_id) >= 0) {
|
||||
/* We already have this controller */
|
||||
if (FindGamepad(gamepad_id) >= 0) {
|
||||
/* We already have this gamepad */
|
||||
return;
|
||||
}
|
||||
|
||||
controller = SDL_GameControllerOpen(device_index);
|
||||
if (controller == NULL) {
|
||||
SDL_Log("Couldn't open controller: %s\n", SDL_GetError());
|
||||
new_gamepad = SDL_OpenGamepad(device_index);
|
||||
if (new_gamepad == NULL) {
|
||||
SDL_Log("Couldn't open gamepad: %s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
controllers = (SDL_GameController **)SDL_realloc(gamecontrollers, (num_controllers + 1) * sizeof(*controllers));
|
||||
if (controllers == NULL) {
|
||||
SDL_GameControllerClose(controller);
|
||||
new_gamepads = (SDL_Gamepad **)SDL_realloc(gamepads, (num_gamepads + 1) * sizeof(*gamepads));
|
||||
if (new_gamepads == NULL) {
|
||||
SDL_CloseGamepad(gamepad);
|
||||
return;
|
||||
}
|
||||
|
||||
controllers[num_controllers++] = controller;
|
||||
gamecontrollers = controllers;
|
||||
gamecontroller = controller;
|
||||
new_gamepads[num_gamepads++] = new_gamepad;
|
||||
gamepads = new_gamepads;
|
||||
gamepad = new_gamepad;
|
||||
trigger_effect = 0;
|
||||
|
||||
if (verbose) {
|
||||
const char *name = SDL_GameControllerName(gamecontroller);
|
||||
const char *path = SDL_GameControllerPath(gamecontroller);
|
||||
SDL_Log("Opened game controller %s%s%s\n", name, path ? ", " : "", path ? path : "");
|
||||
const char *name = SDL_GetGamepadName(gamepad);
|
||||
const char *path = SDL_GetGamepadPath(gamepad);
|
||||
SDL_Log("Opened gamepad %s%s%s\n", name, path ? ", " : "", path ? path : "");
|
||||
}
|
||||
|
||||
firmware_version = SDL_GameControllerGetFirmwareVersion(gamecontroller);
|
||||
firmware_version = SDL_GetGamepadFirmwareVersion(gamepad);
|
||||
if (firmware_version) {
|
||||
if (verbose) {
|
||||
SDL_Log("Firmware version: 0x%x (%d)\n", firmware_version, firmware_version);
|
||||
@ -225,58 +225,58 @@ static void AddController(int device_index, SDL_bool verbose)
|
||||
for (i = 0; i < SDL_arraysize(sensors); ++i) {
|
||||
SDL_SensorType sensor = sensors[i];
|
||||
|
||||
if (SDL_GameControllerHasSensor(gamecontroller, sensor)) {
|
||||
if (SDL_GamepadHasSensor(gamepad, sensor)) {
|
||||
if (verbose) {
|
||||
SDL_Log("Enabling %s at %.2f Hz\n", GetSensorName(sensor), SDL_GameControllerGetSensorDataRate(gamecontroller, sensor));
|
||||
SDL_Log("Enabling %s at %.2f Hz\n", GetSensorName(sensor), SDL_GetGamepadSensorDataRate(gamepad, sensor));
|
||||
}
|
||||
SDL_GameControllerSetSensorEnabled(gamecontroller, sensor, SDL_TRUE);
|
||||
SDL_SetGamepadSensorEnabled(gamepad, sensor, SDL_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_GameControllerHasRumble(gamecontroller)) {
|
||||
if (SDL_GamepadHasRumble(gamepad)) {
|
||||
SDL_Log("Rumble supported");
|
||||
}
|
||||
|
||||
if (SDL_GameControllerHasRumbleTriggers(gamecontroller)) {
|
||||
if (SDL_GamepadHasRumbleTriggers(gamepad)) {
|
||||
SDL_Log("Trigger rumble supported");
|
||||
}
|
||||
|
||||
UpdateWindowTitle();
|
||||
}
|
||||
|
||||
static void SetController(SDL_JoystickID controller)
|
||||
static void SetGamepad(SDL_JoystickID gamepad_id)
|
||||
{
|
||||
int i = FindController(controller);
|
||||
int i = FindGamepad(gamepad_id);
|
||||
|
||||
if (i < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gamecontroller != gamecontrollers[i]) {
|
||||
gamecontroller = gamecontrollers[i];
|
||||
if (gamepad != gamepads[i]) {
|
||||
gamepad = gamepads[i];
|
||||
UpdateWindowTitle();
|
||||
}
|
||||
}
|
||||
|
||||
static void DelController(SDL_JoystickID controller)
|
||||
static void DelGamepad(SDL_JoystickID gamepad_id)
|
||||
{
|
||||
int i = FindController(controller);
|
||||
int i = FindGamepad(gamepad_id);
|
||||
|
||||
if (i < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_GameControllerClose(gamecontrollers[i]);
|
||||
SDL_CloseGamepad(gamepads[i]);
|
||||
|
||||
--num_controllers;
|
||||
if (i < num_controllers) {
|
||||
SDL_memcpy(&gamecontrollers[i], &gamecontrollers[i + 1], (num_controllers - i) * sizeof(*gamecontrollers));
|
||||
--num_gamepads;
|
||||
if (i < num_gamepads) {
|
||||
SDL_memcpy(&gamepads[i], &gamepads[i + 1], (num_gamepads - i) * sizeof(*gamepads));
|
||||
}
|
||||
|
||||
if (num_controllers > 0) {
|
||||
gamecontroller = gamecontrollers[0];
|
||||
if (num_gamepads > 0) {
|
||||
gamepad = gamepads[0];
|
||||
} else {
|
||||
gamecontroller = NULL;
|
||||
gamepad = NULL;
|
||||
}
|
||||
UpdateWindowTitle();
|
||||
}
|
||||
@ -339,7 +339,7 @@ static void CyclePS5TriggerEffect()
|
||||
state.ucEnableBits1 |= (0x04 | 0x08); /* Modify right and left trigger effect respectively */
|
||||
SDL_memcpy(state.rgucRightTriggerEffect, effects[trigger_effect], sizeof(effects[trigger_effect]));
|
||||
SDL_memcpy(state.rgucLeftTriggerEffect, effects[trigger_effect], sizeof(effects[trigger_effect]));
|
||||
SDL_GameControllerSendEffect(gamecontroller, &state, sizeof(state));
|
||||
SDL_SendGamepadEffect(gamepad, &state, sizeof(state));
|
||||
}
|
||||
|
||||
static SDL_bool ShowingFront()
|
||||
@ -347,10 +347,10 @@ static SDL_bool ShowingFront()
|
||||
SDL_bool showing_front = SDL_TRUE;
|
||||
int i;
|
||||
|
||||
if (gamecontroller) {
|
||||
/* Show the back of the controller if the paddles are being held */
|
||||
for (i = SDL_CONTROLLER_BUTTON_PADDLE1; i <= SDL_CONTROLLER_BUTTON_PADDLE4; ++i) {
|
||||
if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) {
|
||||
if (gamepad) {
|
||||
/* Show the back of the gamepad if the paddles are being held */
|
||||
for (i = SDL_GAMEPAD_BUTTON_PADDLE1; i <= SDL_GAMEPAD_BUTTON_PADDLE4; ++i) {
|
||||
if (SDL_GetGamepadButton(gamepad, (SDL_GamepadButton)i) == SDL_PRESSED) {
|
||||
showing_front = SDL_FALSE;
|
||||
break;
|
||||
}
|
||||
@ -362,30 +362,30 @@ static SDL_bool ShowingFront()
|
||||
return showing_front;
|
||||
}
|
||||
|
||||
static void SDLCALL VirtualControllerSetPlayerIndex(void *userdata, int player_index)
|
||||
static void SDLCALL VirtualGamepadSetPlayerIndex(void *userdata, int player_index)
|
||||
{
|
||||
SDL_Log("Virtual Controller: player index set to %d\n", player_index);
|
||||
SDL_Log("Virtual Gamepad: player index set to %d\n", player_index);
|
||||
}
|
||||
|
||||
static int SDLCALL VirtualControllerRumble(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
static int SDLCALL VirtualGamepadRumble(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||
{
|
||||
SDL_Log("Virtual Controller: rumble set to %d/%d\n", low_frequency_rumble, high_frequency_rumble);
|
||||
SDL_Log("Virtual Gamepad: rumble set to %d/%d\n", low_frequency_rumble, high_frequency_rumble);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int SDLCALL VirtualControllerRumbleTriggers(void *userdata, Uint16 left_rumble, Uint16 right_rumble)
|
||||
static int SDLCALL VirtualGamepadRumbleTriggers(void *userdata, Uint16 left_rumble, Uint16 right_rumble)
|
||||
{
|
||||
SDL_Log("Virtual Controller: trigger rumble set to %d/%d\n", left_rumble, right_rumble);
|
||||
SDL_Log("Virtual Gamepad: trigger rumble set to %d/%d\n", left_rumble, right_rumble);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int SDLCALL VirtualControllerSetLED(void *userdata, Uint8 red, Uint8 green, Uint8 blue)
|
||||
static int SDLCALL VirtualGamepadSetLED(void *userdata, Uint8 red, Uint8 green, Uint8 blue)
|
||||
{
|
||||
SDL_Log("Virtual Controller: LED set to RGB %d,%d,%d\n", red, green, blue);
|
||||
SDL_Log("Virtual Gamepad: LED set to RGB %d,%d,%d\n", red, green, blue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void OpenVirtualController()
|
||||
static void OpenVirtualGamepad()
|
||||
{
|
||||
SDL_VirtualJoystickDesc desc;
|
||||
int virtual_index;
|
||||
@ -393,12 +393,12 @@ static void OpenVirtualController()
|
||||
SDL_zero(desc);
|
||||
desc.version = SDL_VIRTUAL_JOYSTICK_DESC_VERSION;
|
||||
desc.type = SDL_JOYSTICK_TYPE_GAMECONTROLLER;
|
||||
desc.naxes = SDL_CONTROLLER_AXIS_MAX;
|
||||
desc.nbuttons = SDL_CONTROLLER_BUTTON_MAX;
|
||||
desc.SetPlayerIndex = VirtualControllerSetPlayerIndex;
|
||||
desc.Rumble = VirtualControllerRumble;
|
||||
desc.RumbleTriggers = VirtualControllerRumbleTriggers;
|
||||
desc.SetLED = VirtualControllerSetLED;
|
||||
desc.naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
desc.nbuttons = SDL_GAMEPAD_BUTTON_MAX;
|
||||
desc.SetPlayerIndex = VirtualGamepadSetPlayerIndex;
|
||||
desc.Rumble = VirtualGamepadRumble;
|
||||
desc.RumbleTriggers = VirtualGamepadRumbleTriggers;
|
||||
desc.SetLED = VirtualGamepadSetLED;
|
||||
|
||||
virtual_index = SDL_AttachVirtualJoystickEx(&desc);
|
||||
if (virtual_index < 0) {
|
||||
@ -411,7 +411,7 @@ static void OpenVirtualController()
|
||||
}
|
||||
}
|
||||
|
||||
static void CloseVirtualController()
|
||||
static void CloseVirtualGamepad()
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -427,7 +427,7 @@ static void CloseVirtualController()
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_GameControllerButton FindButtonAtPosition(int x, int y)
|
||||
static SDL_GamepadButton FindButtonAtPosition(int x, int y)
|
||||
{
|
||||
SDL_Point point;
|
||||
int i;
|
||||
@ -435,8 +435,8 @@ static SDL_GameControllerButton FindButtonAtPosition(int x, int y)
|
||||
|
||||
point.x = x;
|
||||
point.y = y;
|
||||
for (i = 0; i < SDL_CONTROLLER_BUTTON_TOUCHPAD; ++i) {
|
||||
SDL_bool on_front = (i < SDL_CONTROLLER_BUTTON_PADDLE1 || i > SDL_CONTROLLER_BUTTON_PADDLE4);
|
||||
for (i = 0; i < SDL_GAMEPAD_BUTTON_TOUCHPAD; ++i) {
|
||||
SDL_bool on_front = (i < SDL_GAMEPAD_BUTTON_PADDLE1 || i > SDL_GAMEPAD_BUTTON_PADDLE4);
|
||||
if (on_front == showing_front) {
|
||||
SDL_Rect rect;
|
||||
rect.x = button_positions[i].x;
|
||||
@ -444,14 +444,14 @@ static SDL_GameControllerButton FindButtonAtPosition(int x, int y)
|
||||
rect.w = BUTTON_SIZE;
|
||||
rect.h = BUTTON_SIZE;
|
||||
if (SDL_PointInRect(&point, &rect)) {
|
||||
return (SDL_GameControllerButton)i;
|
||||
return (SDL_GamepadButton)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return SDL_CONTROLLER_BUTTON_INVALID;
|
||||
return SDL_GAMEPAD_BUTTON_INVALID;
|
||||
}
|
||||
|
||||
static SDL_GameControllerAxis FindAxisAtPosition(int x, int y)
|
||||
static SDL_GamepadAxis FindAxisAtPosition(int x, int y)
|
||||
{
|
||||
SDL_Point point;
|
||||
int i;
|
||||
@ -459,7 +459,7 @@ static SDL_GameControllerAxis FindAxisAtPosition(int x, int y)
|
||||
|
||||
point.x = x;
|
||||
point.y = y;
|
||||
for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; ++i) {
|
||||
for (i = 0; i < SDL_GAMEPAD_AXIS_MAX; ++i) {
|
||||
if (showing_front) {
|
||||
SDL_Rect rect;
|
||||
rect.x = axis_positions[i].x;
|
||||
@ -467,29 +467,29 @@ static SDL_GameControllerAxis FindAxisAtPosition(int x, int y)
|
||||
rect.w = AXIS_SIZE;
|
||||
rect.h = AXIS_SIZE;
|
||||
if (SDL_PointInRect(&point, &rect)) {
|
||||
return (SDL_GameControllerAxis)i;
|
||||
return (SDL_GamepadAxis)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return SDL_CONTROLLER_AXIS_INVALID;
|
||||
return SDL_GAMEPAD_AXIS_INVALID;
|
||||
}
|
||||
|
||||
static void VirtualControllerMouseMotion(int x, int y)
|
||||
static void VirtualGamepadMouseMotion(int x, int y)
|
||||
{
|
||||
if (virtual_button_active != SDL_CONTROLLER_BUTTON_INVALID) {
|
||||
if (virtual_axis_active != SDL_CONTROLLER_AXIS_INVALID) {
|
||||
if (virtual_button_active != SDL_GAMEPAD_BUTTON_INVALID) {
|
||||
if (virtual_axis_active != SDL_GAMEPAD_AXIS_INVALID) {
|
||||
const int MOVING_DISTANCE = 2;
|
||||
if (SDL_abs(x - virtual_axis_start_x) >= MOVING_DISTANCE ||
|
||||
SDL_abs(y - virtual_axis_start_y) >= MOVING_DISTANCE) {
|
||||
SDL_SetJoystickVirtualButton(virtual_joystick, virtual_button_active, SDL_RELEASED);
|
||||
virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID;
|
||||
virtual_button_active = SDL_GAMEPAD_BUTTON_INVALID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (virtual_axis_active != SDL_CONTROLLER_AXIS_INVALID) {
|
||||
if (virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERLEFT ||
|
||||
virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) {
|
||||
if (virtual_axis_active != SDL_GAMEPAD_AXIS_INVALID) {
|
||||
if (virtual_axis_active == SDL_GAMEPAD_AXIS_LEFT_TRIGGER ||
|
||||
virtual_axis_active == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) {
|
||||
int range = (SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN);
|
||||
float distance = SDL_clamp(((float)y - virtual_axis_start_y) / AXIS_SIZE, 0.0f, 1.0f);
|
||||
Sint16 value = (Sint16)(SDL_JOYSTICK_AXIS_MIN + (distance * range));
|
||||
@ -515,41 +515,41 @@ static void VirtualControllerMouseMotion(int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
static void VirtualControllerMouseDown(int x, int y)
|
||||
static void VirtualGamepadMouseDown(int x, int y)
|
||||
{
|
||||
SDL_GameControllerButton button;
|
||||
SDL_GameControllerAxis axis;
|
||||
SDL_GamepadButton button;
|
||||
SDL_GamepadAxis axis;
|
||||
|
||||
button = FindButtonAtPosition(x, y);
|
||||
if (button != SDL_CONTROLLER_BUTTON_INVALID) {
|
||||
if (button != SDL_GAMEPAD_BUTTON_INVALID) {
|
||||
virtual_button_active = button;
|
||||
SDL_SetJoystickVirtualButton(virtual_joystick, virtual_button_active, SDL_PRESSED);
|
||||
}
|
||||
|
||||
axis = FindAxisAtPosition(x, y);
|
||||
if (axis != SDL_CONTROLLER_AXIS_INVALID) {
|
||||
if (axis != SDL_GAMEPAD_AXIS_INVALID) {
|
||||
virtual_axis_active = axis;
|
||||
virtual_axis_start_x = x;
|
||||
virtual_axis_start_y = y;
|
||||
}
|
||||
}
|
||||
|
||||
static void VirtualControllerMouseUp(int x, int y)
|
||||
static void VirtualGamepadMouseUp(int x, int y)
|
||||
{
|
||||
if (virtual_button_active != SDL_CONTROLLER_BUTTON_INVALID) {
|
||||
if (virtual_button_active != SDL_GAMEPAD_BUTTON_INVALID) {
|
||||
SDL_SetJoystickVirtualButton(virtual_joystick, virtual_button_active, SDL_RELEASED);
|
||||
virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID;
|
||||
virtual_button_active = SDL_GAMEPAD_BUTTON_INVALID;
|
||||
}
|
||||
|
||||
if (virtual_axis_active != SDL_CONTROLLER_AXIS_INVALID) {
|
||||
if (virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERLEFT ||
|
||||
virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) {
|
||||
if (virtual_axis_active != SDL_GAMEPAD_AXIS_INVALID) {
|
||||
if (virtual_axis_active == SDL_GAMEPAD_AXIS_LEFT_TRIGGER ||
|
||||
virtual_axis_active == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) {
|
||||
SDL_SetJoystickVirtualAxis(virtual_joystick, virtual_axis_active, SDL_JOYSTICK_AXIS_MIN);
|
||||
} else {
|
||||
SDL_SetJoystickVirtualAxis(virtual_joystick, virtual_axis_active, 0);
|
||||
SDL_SetJoystickVirtualAxis(virtual_joystick, virtual_axis_active + 1, 0);
|
||||
}
|
||||
virtual_axis_active = SDL_CONTROLLER_AXIS_INVALID;
|
||||
virtual_axis_active = SDL_GAMEPAD_AXIS_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,24 +565,24 @@ void loop(void *arg)
|
||||
/* Process all currently pending events */
|
||||
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1) {
|
||||
switch (event.type) {
|
||||
case SDL_CONTROLLERDEVICEADDED:
|
||||
SDL_Log("Game controller device %d added.\n", (int)SDL_GetJoystickDeviceInstanceID(event.cdevice.which));
|
||||
AddController(event.cdevice.which, SDL_TRUE);
|
||||
case SDL_GAMEPADADDED:
|
||||
SDL_Log("Gamepad device %d added.\n", (int)SDL_GetJoystickDeviceInstanceID(event.cdevice.which));
|
||||
AddGamepad(event.cdevice.which, SDL_TRUE);
|
||||
break;
|
||||
|
||||
case SDL_CONTROLLERDEVICEREMOVED:
|
||||
SDL_Log("Game controller device %d removed.\n", (int)event.cdevice.which);
|
||||
DelController(event.cdevice.which);
|
||||
case SDL_GAMEPADREMOVED:
|
||||
SDL_Log("Gamepad device %d removed.\n", (int)event.cdevice.which);
|
||||
DelGamepad(event.cdevice.which);
|
||||
break;
|
||||
|
||||
case SDL_CONTROLLERTOUCHPADDOWN:
|
||||
case SDL_CONTROLLERTOUCHPADMOTION:
|
||||
case SDL_CONTROLLERTOUCHPADUP:
|
||||
SDL_Log("Controller %" SDL_PRIs32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n",
|
||||
case SDL_GAMEPADTOUCHPADDOWN:
|
||||
case SDL_GAMEPADTOUCHPADMOTION:
|
||||
case SDL_GAMEPADTOUCHPADUP:
|
||||
SDL_Log("Gamepad %" SDL_PRIs32 " touchpad %" SDL_PRIs32 " finger %" SDL_PRIs32 " %s %.2f, %.2f, %.2f\n",
|
||||
event.ctouchpad.which,
|
||||
event.ctouchpad.touchpad,
|
||||
event.ctouchpad.finger,
|
||||
(event.type == SDL_CONTROLLERTOUCHPADDOWN ? "pressed at" : (event.type == SDL_CONTROLLERTOUCHPADUP ? "released at" : "moved to")),
|
||||
(event.type == SDL_GAMEPADTOUCHPADDOWN ? "pressed at" : (event.type == SDL_GAMEPADTOUCHPADUP ? "released at" : "moved to")),
|
||||
event.ctouchpad.x,
|
||||
event.ctouchpad.y,
|
||||
event.ctouchpad.pressure);
|
||||
@ -590,8 +590,8 @@ void loop(void *arg)
|
||||
|
||||
#define VERBOSE_SENSORS
|
||||
#ifdef VERBOSE_SENSORS
|
||||
case SDL_CONTROLLERSENSORUPDATE:
|
||||
SDL_Log("Controller %" SDL_PRIs32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n",
|
||||
case SDL_GAMEPADSENSORUPDATE:
|
||||
SDL_Log("Gamepad %" SDL_PRIs32 " sensor %s: %.2f, %.2f, %.2f (%" SDL_PRIu64 ")\n",
|
||||
event.csensor.which,
|
||||
GetSensorName((SDL_SensorType)event.csensor.sensor),
|
||||
event.csensor.data[0],
|
||||
@ -603,66 +603,66 @@ void loop(void *arg)
|
||||
|
||||
#define VERBOSE_AXES
|
||||
#ifdef VERBOSE_AXES
|
||||
case SDL_CONTROLLERAXISMOTION:
|
||||
case SDL_GAMEPADAXISMOTION:
|
||||
if (event.caxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.caxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) {
|
||||
SetController(event.caxis.which);
|
||||
SetGamepad(event.caxis.which);
|
||||
}
|
||||
SDL_Log("Controller %" SDL_PRIs32 " axis %s changed to %d\n", event.caxis.which, SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value);
|
||||
SDL_Log("Gamepad %" SDL_PRIs32 " axis %s changed to %d\n", event.caxis.which, SDL_GetGamepadStringForAxis((SDL_GamepadAxis)event.caxis.axis), event.caxis.value);
|
||||
break;
|
||||
#endif /* VERBOSE_AXES */
|
||||
|
||||
case SDL_CONTROLLERBUTTONDOWN:
|
||||
case SDL_CONTROLLERBUTTONUP:
|
||||
if (event.type == SDL_CONTROLLERBUTTONDOWN) {
|
||||
SetController(event.cbutton.which);
|
||||
case SDL_GAMEPADBUTTONDOWN:
|
||||
case SDL_GAMEPADBUTTONUP:
|
||||
if (event.type == SDL_GAMEPADBUTTONDOWN) {
|
||||
SetGamepad(event.cbutton.which);
|
||||
}
|
||||
SDL_Log("Controller %" SDL_PRIs32 " button %s %s\n", event.cbutton.which, SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released");
|
||||
SDL_Log("Gamepad %" SDL_PRIs32 " button %s %s\n", event.cbutton.which, SDL_GetGamepadStringForButton((SDL_GamepadButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released");
|
||||
|
||||
/* Cycle PS5 trigger effects when the microphone button is pressed */
|
||||
if (event.type == SDL_CONTROLLERBUTTONDOWN &&
|
||||
event.cbutton.button == SDL_CONTROLLER_BUTTON_MISC1 &&
|
||||
SDL_GameControllerGetType(gamecontroller) == SDL_CONTROLLER_TYPE_PS5) {
|
||||
if (event.type == SDL_GAMEPADBUTTONDOWN &&
|
||||
event.cbutton.button == SDL_GAMEPAD_BUTTON_MISC1 &&
|
||||
SDL_GetGamepadType(gamepad) == SDL_GAMEPAD_TYPE_PS5) {
|
||||
CyclePS5TriggerEffect();
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_JOYBATTERYUPDATED:
|
||||
SDL_Log("Controller %" SDL_PRIs32 " battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]);
|
||||
SDL_Log("Gamepad %" SDL_PRIs32 " battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]);
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (virtual_joystick) {
|
||||
VirtualControllerMouseDown(event.button.x, event.button.y);
|
||||
VirtualGamepadMouseDown(event.button.x, event.button.y);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (virtual_joystick) {
|
||||
VirtualControllerMouseUp(event.button.x, event.button.y);
|
||||
VirtualGamepadMouseUp(event.button.x, event.button.y);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
if (virtual_joystick) {
|
||||
VirtualControllerMouseMotion(event.motion.x, event.motion.y);
|
||||
VirtualGamepadMouseMotion(event.motion.x, event.motion.y);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
if (event.key.keysym.sym >= SDLK_0 && event.key.keysym.sym <= SDLK_9) {
|
||||
if (gamecontroller) {
|
||||
if (gamepad) {
|
||||
int player_index = (event.key.keysym.sym - SDLK_0);
|
||||
|
||||
SDL_GameControllerSetPlayerIndex(gamecontroller, player_index);
|
||||
SDL_SetGamepadPlayerIndex(gamepad, player_index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (event.key.keysym.sym == SDLK_a) {
|
||||
OpenVirtualController();
|
||||
OpenVirtualGamepad();
|
||||
break;
|
||||
}
|
||||
if (event.key.keysym.sym == SDLK_d) {
|
||||
CloseVirtualController();
|
||||
CloseVirtualGamepad();
|
||||
break;
|
||||
}
|
||||
if (event.key.keysym.sym != SDLK_ESCAPE) {
|
||||
@ -684,11 +684,11 @@ void loop(void *arg)
|
||||
SDL_RenderClear(screen);
|
||||
SDL_RenderTexture(screen, showing_front ? background_front : background_back, NULL, NULL);
|
||||
|
||||
if (gamecontroller) {
|
||||
/* Update visual controller state */
|
||||
for (i = 0; i < SDL_CONTROLLER_BUTTON_TOUCHPAD; ++i) {
|
||||
if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) {
|
||||
SDL_bool on_front = (i < SDL_CONTROLLER_BUTTON_PADDLE1 || i > SDL_CONTROLLER_BUTTON_PADDLE4);
|
||||
if (gamepad) {
|
||||
/* Update visual gamepad state */
|
||||
for (i = 0; i < SDL_GAMEPAD_BUTTON_TOUCHPAD; ++i) {
|
||||
if (SDL_GetGamepadButton(gamepad, (SDL_GamepadButton)i) == SDL_PRESSED) {
|
||||
SDL_bool on_front = (i < SDL_GAMEPAD_BUTTON_PADDLE1 || i > SDL_GAMEPAD_BUTTON_PADDLE4);
|
||||
if (on_front == showing_front) {
|
||||
SDL_Rect dst;
|
||||
dst.x = button_positions[i].x;
|
||||
@ -701,9 +701,9 @@ void loop(void *arg)
|
||||
}
|
||||
|
||||
if (showing_front) {
|
||||
for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; ++i) {
|
||||
for (i = 0; i < SDL_GAMEPAD_AXIS_MAX; ++i) {
|
||||
const Sint16 deadzone = 8000; /* !!! FIXME: real deadzone */
|
||||
const Sint16 value = SDL_GameControllerGetAxis(gamecontroller, (SDL_GameControllerAxis)(i));
|
||||
const Sint16 value = SDL_GetGamepadAxis(gamepad, (SDL_GamepadAxis)(i));
|
||||
if (value < -deadzone) {
|
||||
const double angle = axis_positions[i].angle;
|
||||
SDL_Rect dst;
|
||||
@ -726,8 +726,8 @@ void loop(void *arg)
|
||||
|
||||
/* Update LED based on left thumbstick position */
|
||||
{
|
||||
Sint16 x = SDL_GameControllerGetAxis(gamecontroller, SDL_CONTROLLER_AXIS_LEFTX);
|
||||
Sint16 y = SDL_GameControllerGetAxis(gamecontroller, SDL_CONTROLLER_AXIS_LEFTY);
|
||||
Sint16 x = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_LEFTX);
|
||||
Sint16 y = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_LEFTY);
|
||||
|
||||
if (!set_LED) {
|
||||
set_LED = (x < -8000 || x > 8000 || y > 8000);
|
||||
@ -748,28 +748,28 @@ void loop(void *arg)
|
||||
g = 0;
|
||||
}
|
||||
|
||||
SDL_GameControllerSetLED(gamecontroller, r, g, b);
|
||||
SDL_SetGamepadLED(gamepad, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
if (trigger_effect == 0) {
|
||||
/* Update rumble based on trigger state */
|
||||
{
|
||||
Sint16 left = SDL_GameControllerGetAxis(gamecontroller, SDL_CONTROLLER_AXIS_TRIGGERLEFT);
|
||||
Sint16 right = SDL_GameControllerGetAxis(gamecontroller, SDL_CONTROLLER_AXIS_TRIGGERRIGHT);
|
||||
Sint16 left = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_LEFT_TRIGGER);
|
||||
Sint16 right = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER);
|
||||
Uint16 low_frequency_rumble = ConvertAxisToRumble(left);
|
||||
Uint16 high_frequency_rumble = ConvertAxisToRumble(right);
|
||||
SDL_GameControllerRumble(gamecontroller, low_frequency_rumble, high_frequency_rumble, 250);
|
||||
SDL_RumbleGamepad(gamepad, low_frequency_rumble, high_frequency_rumble, 250);
|
||||
}
|
||||
|
||||
/* Update trigger rumble based on thumbstick state */
|
||||
{
|
||||
Sint16 left = SDL_GameControllerGetAxis(gamecontroller, SDL_CONTROLLER_AXIS_LEFTY);
|
||||
Sint16 right = SDL_GameControllerGetAxis(gamecontroller, SDL_CONTROLLER_AXIS_RIGHTY);
|
||||
Sint16 left = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_LEFTY);
|
||||
Sint16 right = SDL_GetGamepadAxis(gamepad, SDL_GAMEPAD_AXIS_RIGHTY);
|
||||
Uint16 left_rumble = ConvertAxisToRumble(~left);
|
||||
Uint16 right_rumble = ConvertAxisToRumble(~right);
|
||||
|
||||
SDL_GameControllerRumbleTriggers(gamecontroller, left_rumble, right_rumble, 250);
|
||||
SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, 250);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -786,8 +786,8 @@ void loop(void *arg)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int controller_count = 0;
|
||||
int controller_index = 0;
|
||||
int gamepad_count = 0;
|
||||
int gamepad_index = 0;
|
||||
char guid[64];
|
||||
|
||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
||||
@ -802,18 +802,18 @@ int main(int argc, char *argv[])
|
||||
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 | SDL_INIT_GAMECONTROLLER) < 0) {
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");
|
||||
SDL_AddGamepadMappingsFromFile("gamecontrollerdb.txt");
|
||||
|
||||
/* Print information about the mappings */
|
||||
if (argv[1] && SDL_strcmp(argv[1], "--mappings") == 0) {
|
||||
SDL_Log("Supported mappings:\n");
|
||||
for (i = 0; i < SDL_GameControllerNumMappings(); ++i) {
|
||||
char *mapping = SDL_GameControllerMappingForIndex(i);
|
||||
for (i = 0; i < SDL_GetNumGamepadMappings(); ++i) {
|
||||
char *mapping = SDL_GetGamepadMappingForIndex(i);
|
||||
if (mapping) {
|
||||
SDL_Log("\t%s\n", mapping);
|
||||
SDL_free(mapping);
|
||||
@ -822,7 +822,7 @@ int main(int argc, char *argv[])
|
||||
SDL_Log("\n");
|
||||
}
|
||||
|
||||
/* Print information about the controller */
|
||||
/* Print information about the gamepad */
|
||||
for (i = 0; i < SDL_GetNumJoysticks(); ++i) {
|
||||
const char *name;
|
||||
const char *path;
|
||||
@ -831,48 +831,48 @@ int main(int argc, char *argv[])
|
||||
SDL_GetJoystickGUIDString(SDL_GetJoystickDeviceGUID(i),
|
||||
guid, sizeof(guid));
|
||||
|
||||
if (SDL_IsGameController(i)) {
|
||||
controller_count++;
|
||||
name = SDL_GameControllerNameForIndex(i);
|
||||
path = SDL_GameControllerPathForIndex(i);
|
||||
switch (SDL_GameControllerTypeForIndex(i)) {
|
||||
case SDL_CONTROLLER_TYPE_AMAZON_LUNA:
|
||||
if (SDL_IsGamepad(i)) {
|
||||
gamepad_count++;
|
||||
name = SDL_GetGamepadNameForIndex(i);
|
||||
path = SDL_GetGamepadPathForIndex(i);
|
||||
switch (SDL_GetGamepadTypeForIndex(i)) {
|
||||
case SDL_GAMEPAD_TYPE_AMAZON_LUNA:
|
||||
description = "Amazon Luna Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_GOOGLE_STADIA:
|
||||
case SDL_GAMEPAD_TYPE_GOOGLE_STADIA:
|
||||
description = "Google Stadia Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT:
|
||||
case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT:
|
||||
case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR:
|
||||
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT:
|
||||
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT:
|
||||
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR:
|
||||
description = "Nintendo Switch Joy-Con";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO:
|
||||
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO:
|
||||
description = "Nintendo Switch Pro Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_PS3:
|
||||
case SDL_GAMEPAD_TYPE_PS3:
|
||||
description = "PS3 Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_PS4:
|
||||
case SDL_GAMEPAD_TYPE_PS4:
|
||||
description = "PS4 Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_PS5:
|
||||
case SDL_GAMEPAD_TYPE_PS5:
|
||||
description = "PS5 Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_XBOX360:
|
||||
case SDL_GAMEPAD_TYPE_XBOX360:
|
||||
description = "XBox 360 Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_XBOXONE:
|
||||
case SDL_GAMEPAD_TYPE_XBOXONE:
|
||||
description = "XBox One Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_VIRTUAL:
|
||||
description = "Virtual Game Controller";
|
||||
case SDL_GAMEPAD_TYPE_VIRTUAL:
|
||||
description = "Virtual Gamepad";
|
||||
break;
|
||||
default:
|
||||
description = "Game Controller";
|
||||
description = "Gamepad";
|
||||
break;
|
||||
}
|
||||
AddController(i, SDL_FALSE);
|
||||
AddGamepad(i, SDL_FALSE);
|
||||
} else {
|
||||
name = SDL_GetJoystickNameForIndex(i);
|
||||
path = SDL_GetJoystickPathForIndex(i);
|
||||
@ -882,10 +882,10 @@ int main(int argc, char *argv[])
|
||||
description, i, name ? name : "Unknown", path ? ", " : "", path ? path : "", guid,
|
||||
SDL_GetJoystickDeviceVendor(i), SDL_GetJoystickDeviceProduct(i), SDL_GetJoystickDevicePlayerIndex(i));
|
||||
}
|
||||
SDL_Log("There are %d game controller(s) attached (%d joystick(s))\n", controller_count, SDL_GetNumJoysticks());
|
||||
SDL_Log("There are %d gamepad(s) attached (%d joystick(s))\n", gamepad_count, SDL_GetNumJoysticks());
|
||||
|
||||
/* Create a window to display controller state */
|
||||
window = SDL_CreateWindow("Game Controller Test", SDL_WINDOWPOS_CENTERED,
|
||||
/* Create a window to display gamepad state */
|
||||
window = SDL_CreateWindow("Gamepad Test", SDL_WINDOWPOS_CENTERED,
|
||||
SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,
|
||||
SCREEN_HEIGHT, 0);
|
||||
if (window == NULL) {
|
||||
@ -907,8 +907,8 @@ int main(int argc, char *argv[])
|
||||
/* scale for platforms that don't give you the window size you asked for. */
|
||||
SDL_SetRenderLogicalSize(screen, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE, NULL, NULL);
|
||||
background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE, NULL, NULL);
|
||||
background_front = LoadTexture(screen, "gamepadmap.bmp", SDL_FALSE, NULL, NULL);
|
||||
background_back = LoadTexture(screen, "gamepadmap_back.bmp", SDL_FALSE, NULL, NULL);
|
||||
button_texture = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL);
|
||||
axis_texture = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL);
|
||||
|
||||
@ -925,21 +925,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (i = 1; i < argc; ++i) {
|
||||
if (SDL_strcmp(argv[i], "--virtual") == 0) {
|
||||
OpenVirtualController();
|
||||
OpenVirtualGamepad();
|
||||
}
|
||||
if (argv[i] && *argv[i] != '-') {
|
||||
controller_index = SDL_atoi(argv[i]);
|
||||
gamepad_index = SDL_atoi(argv[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (controller_index < num_controllers) {
|
||||
gamecontroller = gamecontrollers[controller_index];
|
||||
if (gamepad_index < num_gamepads) {
|
||||
gamepad = gamepads[gamepad_index];
|
||||
} else {
|
||||
gamecontroller = NULL;
|
||||
gamepad = NULL;
|
||||
}
|
||||
UpdateWindowTitle();
|
||||
|
||||
/* Loop, getting controller events! */
|
||||
/* Loop, getting gamepad events! */
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_set_main_loop_arg(loop, NULL, 0, 1);
|
||||
#else
|
||||
@ -954,10 +954,10 @@ int main(int argc, char *argv[])
|
||||
CyclePS5TriggerEffect();
|
||||
}
|
||||
|
||||
CloseVirtualController();
|
||||
CloseVirtualGamepad();
|
||||
SDL_DestroyRenderer(screen);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER);
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user