Added shared code between testgamepad and gamepadmap

The goal is to eventually create a single program that can do mapping and testing of game controllers.
This commit is contained in:
Sam Lantinga
2023-07-09 19:22:29 -07:00
parent 550c84b4df
commit 8f5ec2f596
17 changed files with 56303 additions and 883 deletions
File diff suppressed because it is too large Load Diff
@@ -1,55 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\..\test\testgamepad.c" />
<ClCompile Include="..\..\..\test\testutils.c" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="..\..\..\test\gamepadmap_back.bmp" />
<CopyFileToFolders Include="..\..\..\test\axis.bmp" />
<CopyFileToFolders Include="..\..\..\test\button.bmp" />
<CopyFileToFolders Include="..\..\..\test\gamepadmap.bmp" />
<CopyFileToFolders Include="..\..\logos\Logo44x44.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\..\logos\Logo100x100.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\..\logos\Logo150x150.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\..\logos\Logo480x480.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
<Filter>wingdk</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="wingdk\MicrosoftGame.config">
<Filter>wingdk</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="xboxseries\MicrosoftGame.config">
<Filter>xboxseries</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="xboxone\MicrosoftGame.config">
<Filter>xboxone</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\..\logos\SplashScreenImage.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="PackageLayout.xml" />
</ItemGroup>
<ItemGroup>
<Filter Include="logos">
<UniqueIdentifier>{5e858cf0-6fba-498d-b33d-11c8ecbb79c7}</UniqueIdentifier>
</Filter>
<Filter Include="xboxseries">
<UniqueIdentifier>{5790a250-283e-4f51-8f28-6a977d3c7a6c}</UniqueIdentifier>
</Filter>
<Filter Include="wingdk">
<UniqueIdentifier>{a4d235e4-4017-4193-af62-ecb2ac249be4}</UniqueIdentifier>
</Filter>
<Filter Include="xboxone">
<UniqueIdentifier>{e704dcb9-c83c-4c94-a139-b0f3e3f428f2}</UniqueIdentifier>
</Filter>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\..\test\testgamepad.c" />
<ClCompile Include="..\..\..\test\testutils.c" />
<ClCompile Include="..\..\..\test\gamepadutils.c" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="..\..\logos\Logo44x44.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\..\logos\Logo100x100.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\..\logos\Logo150x150.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\..\logos\Logo480x480.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
<Filter>wingdk</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="wingdk\MicrosoftGame.config">
<Filter>wingdk</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="xboxseries\MicrosoftGame.config">
<Filter>xboxseries</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="xboxone\MicrosoftGame.config">
<Filter>xboxone</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\..\logos\SplashScreenImage.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="PackageLayout.xml" />
</ItemGroup>
<ItemGroup>
<Filter Include="logos">
<UniqueIdentifier>{5e858cf0-6fba-498d-b33d-11c8ecbb79c7}</UniqueIdentifier>
</Filter>
<Filter Include="xboxseries">
<UniqueIdentifier>{5790a250-283e-4f51-8f28-6a977d3c7a6c}</UniqueIdentifier>
</Filter>
<Filter Include="wingdk">
<UniqueIdentifier>{a4d235e4-4017-4193-af62-ecb2ac249be4}</UniqueIdentifier>
</Filter>
<Filter Include="xboxone">
<UniqueIdentifier>{e704dcb9-c83c-4c94-a139-b0f3e3f428f2}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
+1 -74
View File
@@ -195,82 +195,9 @@
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\..\test\axis.bmp">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(ProjectDir)\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(ProjectDir)\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(ProjectDir)\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(ProjectDir)\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\..\test\button.bmp">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(ProjectDir)\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(ProjectDir)\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(ProjectDir)\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(ProjectDir)\
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
<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>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
<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>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\test\gamepadmap.c" />
<ClCompile Include="..\..\..\test\gamepadutils.c" />
<ClCompile Include="..\..\..\test\testutils.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+1 -74
View File
@@ -196,80 +196,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\..\test\axis.bmp">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\..\test\button.bmp">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
<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>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
<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>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "%(FullPath)" "$(ProjectDir)\"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\test\gamepadutils.c" />
<ClCompile Include="..\..\..\test\testgamepad.c" />
<ClCompile Include="..\..\..\test\testutils.c" />
</ItemGroup>
+2 -2
View File
@@ -209,7 +209,7 @@ if(SDL3_TESTS_SUBPROJECT)
endif()
add_sdl_test_executable(testfile NONINTERACTIVE SOURCES testfile.c)
add_sdl_test_executable(testgamepad NEEDS_RESOURCES TESTUTILS SOURCES testgamepad.c)
add_sdl_test_executable(testgamepad TESTUTILS SOURCES testgamepad.c gamepadutils.c)
add_sdl_test_executable(testgeometry TESTUTILS SOURCES testgeometry.c)
add_sdl_test_executable(testgl SOURCES testgl.c)
add_sdl_test_executable(testgles SOURCES testgles.c)
@@ -258,7 +258,7 @@ add_sdl_test_executable(testdisplayinfo SOURCES testdisplayinfo.c)
add_sdl_test_executable(testqsort NONINTERACTIVE SOURCES testqsort.c)
add_sdl_test_executable(testbounds NONINTERACTIVE SOURCES testbounds.c)
add_sdl_test_executable(testcustomcursor SOURCES testcustomcursor.c)
add_sdl_test_executable(gamepadmap NEEDS_RESOURCES TESTUTILS SOURCES gamepadmap.c)
add_sdl_test_executable(gamepadmap TESTUTILS SOURCES gamepadmap.c gamepadutils.c)
add_sdl_test_executable(testvulkan NO_C90 SOURCES testvulkan.c)
add_sdl_test_executable(testoffscreen SOURCES testoffscreen.c)
add_sdl_test_executable(testpopup SOURCES testpopup.c)
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

+848
View File
File diff suppressed because it is too large Load Diff
+40590
View File
File diff suppressed because it is too large Load Diff
+316
View File
@@ -0,0 +1,316 @@
unsigned char gamepad_button_bmp[] = {
0x42, 0x4d, 0xa2, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x04,
0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x32, 0x00,
0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x0a,
0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x02, 0x02,
0x02, 0x00, 0x03, 0x03, 0x03, 0x00, 0x04, 0x04, 0x04, 0x00, 0x05, 0x05,
0x05, 0x00, 0x06, 0x06, 0x06, 0x00, 0x07, 0x07, 0x07, 0x00, 0x08, 0x08,
0x08, 0x00, 0x09, 0x09, 0x09, 0x00, 0x0a, 0x0a, 0x0a, 0x00, 0x0b, 0x0b,
0x0b, 0x00, 0x0c, 0x0c, 0x0c, 0x00, 0x0d, 0x0d, 0x0d, 0x00, 0x0e, 0x0e,
0x0e, 0x00, 0x0f, 0x0f, 0x0f, 0x00, 0x10, 0x10, 0x10, 0x00, 0x11, 0x11,
0x11, 0x00, 0x12, 0x12, 0x12, 0x00, 0x13, 0x13, 0x13, 0x00, 0x14, 0x14,
0x14, 0x00, 0x15, 0x15, 0x15, 0x00, 0x16, 0x16, 0x16, 0x00, 0x17, 0x17,
0x17, 0x00, 0x18, 0x18, 0x18, 0x00, 0x19, 0x19, 0x19, 0x00, 0x1a, 0x1a,
0x1a, 0x00, 0x1b, 0x1b, 0x1b, 0x00, 0x1c, 0x1c, 0x1c, 0x00, 0x1d, 0x1d,
0x1d, 0x00, 0x1e, 0x1e, 0x1e, 0x00, 0x1f, 0x1f, 0x1f, 0x00, 0x20, 0x20,
0x20, 0x00, 0x21, 0x21, 0x21, 0x00, 0x22, 0x22, 0x22, 0x00, 0x23, 0x23,
0x23, 0x00, 0x24, 0x24, 0x24, 0x00, 0x25, 0x25, 0x25, 0x00, 0x26, 0x26,
0x26, 0x00, 0x27, 0x27, 0x27, 0x00, 0x28, 0x28, 0x28, 0x00, 0x29, 0x29,
0x29, 0x00, 0x2a, 0x2a, 0x2a, 0x00, 0x2b, 0x2b, 0x2b, 0x00, 0x2c, 0x2c,
0x2c, 0x00, 0x2d, 0x2d, 0x2d, 0x00, 0x2e, 0x2e, 0x2e, 0x00, 0x2f, 0x2f,
0x2f, 0x00, 0x30, 0x30, 0x30, 0x00, 0x31, 0x31, 0x31, 0x00, 0x32, 0x32,
0x32, 0x00, 0x33, 0x33, 0x33, 0x00, 0x34, 0x34, 0x34, 0x00, 0x35, 0x35,
0x35, 0x00, 0x36, 0x36, 0x36, 0x00, 0x37, 0x37, 0x37, 0x00, 0x38, 0x38,
0x38, 0x00, 0x39, 0x39, 0x39, 0x00, 0x3a, 0x3a, 0x3a, 0x00, 0x3b, 0x3b,
0x3b, 0x00, 0x3c, 0x3c, 0x3c, 0x00, 0x3d, 0x3d, 0x3d, 0x00, 0x3e, 0x3e,
0x3e, 0x00, 0x3f, 0x3f, 0x3f, 0x00, 0x40, 0x40, 0x40, 0x00, 0x41, 0x41,
0x41, 0x00, 0x42, 0x42, 0x42, 0x00, 0x43, 0x43, 0x43, 0x00, 0x44, 0x44,
0x44, 0x00, 0x45, 0x45, 0x45, 0x00, 0x46, 0x46, 0x46, 0x00, 0x47, 0x47,
0x47, 0x00, 0x48, 0x48, 0x48, 0x00, 0x49, 0x49, 0x49, 0x00, 0x4a, 0x4a,
0x4a, 0x00, 0x4b, 0x4b, 0x4b, 0x00, 0x4c, 0x4c, 0x4c, 0x00, 0x4d, 0x4d,
0x4d, 0x00, 0x4e, 0x4e, 0x4e, 0x00, 0x4f, 0x4f, 0x4f, 0x00, 0x50, 0x50,
0x50, 0x00, 0x51, 0x51, 0x51, 0x00, 0x52, 0x52, 0x52, 0x00, 0x53, 0x53,
0x53, 0x00, 0x54, 0x54, 0x54, 0x00, 0x55, 0x55, 0x55, 0x00, 0x56, 0x56,
0x56, 0x00, 0x57, 0x57, 0x57, 0x00, 0x58, 0x58, 0x58, 0x00, 0x59, 0x59,
0x59, 0x00, 0x5a, 0x5a, 0x5a, 0x00, 0x5b, 0x5b, 0x5b, 0x00, 0x5c, 0x5c,
0x5c, 0x00, 0x5d, 0x5d, 0x5d, 0x00, 0x5e, 0x5e, 0x5e, 0x00, 0x5f, 0x5f,
0x5f, 0x00, 0x60, 0x60, 0x60, 0x00, 0x61, 0x61, 0x61, 0x00, 0x62, 0x62,
0x62, 0x00, 0x63, 0x63, 0x63, 0x00, 0x64, 0x64, 0x64, 0x00, 0x65, 0x65,
0x65, 0x00, 0x66, 0x66, 0x66, 0x00, 0x67, 0x67, 0x67, 0x00, 0x68, 0x68,
0x68, 0x00, 0x69, 0x69, 0x69, 0x00, 0x6a, 0x6a, 0x6a, 0x00, 0x6b, 0x6b,
0x6b, 0x00, 0x6c, 0x6c, 0x6c, 0x00, 0x6d, 0x6d, 0x6d, 0x00, 0x6e, 0x6e,
0x6e, 0x00, 0x6f, 0x6f, 0x6f, 0x00, 0x70, 0x70, 0x70, 0x00, 0x71, 0x71,
0x71, 0x00, 0x72, 0x72, 0x72, 0x00, 0x73, 0x73, 0x73, 0x00, 0x74, 0x74,
0x74, 0x00, 0x75, 0x75, 0x75, 0x00, 0x76, 0x76, 0x76, 0x00, 0x77, 0x77,
0x77, 0x00, 0x78, 0x78, 0x78, 0x00, 0x79, 0x79, 0x79, 0x00, 0x7a, 0x7a,
0x7a, 0x00, 0x7b, 0x7b, 0x7b, 0x00, 0x7c, 0x7c, 0x7c, 0x00, 0x7d, 0x7d,
0x7d, 0x00, 0x7e, 0x7e, 0x7e, 0x00, 0x7f, 0x7f, 0x7f, 0x00, 0x80, 0x80,
0x80, 0x00, 0x81, 0x81, 0x81, 0x00, 0x82, 0x82, 0x82, 0x00, 0x83, 0x83,
0x83, 0x00, 0x84, 0x84, 0x84, 0x00, 0x85, 0x85, 0x85, 0x00, 0x86, 0x86,
0x86, 0x00, 0x87, 0x87, 0x87, 0x00, 0x88, 0x88, 0x88, 0x00, 0x89, 0x89,
0x89, 0x00, 0x8a, 0x8a, 0x8a, 0x00, 0x8b, 0x8b, 0x8b, 0x00, 0x8c, 0x8c,
0x8c, 0x00, 0x8d, 0x8d, 0x8d, 0x00, 0x8e, 0x8e, 0x8e, 0x00, 0x8f, 0x8f,
0x8f, 0x00, 0x90, 0x90, 0x90, 0x00, 0x91, 0x91, 0x91, 0x00, 0x92, 0x92,
0x92, 0x00, 0x93, 0x93, 0x93, 0x00, 0x94, 0x94, 0x94, 0x00, 0x95, 0x95,
0x95, 0x00, 0x96, 0x96, 0x96, 0x00, 0x97, 0x97, 0x97, 0x00, 0x98, 0x98,
0x98, 0x00, 0x99, 0x99, 0x99, 0x00, 0x9a, 0x9a, 0x9a, 0x00, 0x9b, 0x9b,
0x9b, 0x00, 0x9c, 0x9c, 0x9c, 0x00, 0x9d, 0x9d, 0x9d, 0x00, 0x9e, 0x9e,
0x9e, 0x00, 0x9f, 0x9f, 0x9f, 0x00, 0xa0, 0xa0, 0xa0, 0x00, 0xa1, 0xa1,
0xa1, 0x00, 0xa2, 0xa2, 0xa2, 0x00, 0xa3, 0xa3, 0xa3, 0x00, 0xa4, 0xa4,
0xa4, 0x00, 0xa5, 0xa5, 0xa5, 0x00, 0xa6, 0xa6, 0xa6, 0x00, 0xa7, 0xa7,
0xa7, 0x00, 0xa8, 0xa8, 0xa8, 0x00, 0xa9, 0xa9, 0xa9, 0x00, 0xaa, 0xaa,
0xaa, 0x00, 0xab, 0xab, 0xab, 0x00, 0xac, 0xac, 0xac, 0x00, 0xad, 0xad,
0xad, 0x00, 0xae, 0xae, 0xae, 0x00, 0xaf, 0xaf, 0xaf, 0x00, 0xb0, 0xb0,
0xb0, 0x00, 0xb1, 0xb1, 0xb1, 0x00, 0xb2, 0xb2, 0xb2, 0x00, 0xb3, 0xb3,
0xb3, 0x00, 0xb4, 0xb4, 0xb4, 0x00, 0xb5, 0xb5, 0xb5, 0x00, 0xb6, 0xb6,
0xb6, 0x00, 0xb7, 0xb7, 0xb7, 0x00, 0xb8, 0xb8, 0xb8, 0x00, 0xb9, 0xb9,
0xb9, 0x00, 0xba, 0xba, 0xba, 0x00, 0xbb, 0xbb, 0xbb, 0x00, 0xbc, 0xbc,
0xbc, 0x00, 0xbd, 0xbd, 0xbd, 0x00, 0xbe, 0xbe, 0xbe, 0x00, 0xbf, 0xbf,
0xbf, 0x00, 0xc0, 0xc0, 0xc0, 0x00, 0xc1, 0xc1, 0xc1, 0x00, 0xc2, 0xc2,
0xc2, 0x00, 0xc3, 0xc3, 0xc3, 0x00, 0xc4, 0xc4, 0xc4, 0x00, 0xc5, 0xc5,
0xc5, 0x00, 0xc6, 0xc6, 0xc6, 0x00, 0xc7, 0xc7, 0xc7, 0x00, 0xc8, 0xc8,
0xc8, 0x00, 0xc9, 0xc9, 0xc9, 0x00, 0xca, 0xca, 0xca, 0x00, 0xcb, 0xcb,
0xcb, 0x00, 0xcc, 0xcc, 0xcc, 0x00, 0xcd, 0xcd, 0xcd, 0x00, 0xce, 0xce,
0xce, 0x00, 0xcf, 0xcf, 0xcf, 0x00, 0xd0, 0xd0, 0xd0, 0x00, 0xd1, 0xd1,
0xd1, 0x00, 0xd2, 0xd2, 0xd2, 0x00, 0xd3, 0xd3, 0xd3, 0x00, 0xd4, 0xd4,
0xd4, 0x00, 0xd5, 0xd5, 0xd5, 0x00, 0xd6, 0xd6, 0xd6, 0x00, 0xd7, 0xd7,
0xd7, 0x00, 0xd8, 0xd8, 0xd8, 0x00, 0xd9, 0xd9, 0xd9, 0x00, 0xda, 0xda,
0xda, 0x00, 0xdb, 0xdb, 0xdb, 0x00, 0xdc, 0xdc, 0xdc, 0x00, 0xdd, 0xdd,
0xdd, 0x00, 0xde, 0xde, 0xde, 0x00, 0xdf, 0xdf, 0xdf, 0x00, 0xe0, 0xe0,
0xe0, 0x00, 0xe1, 0xe1, 0xe1, 0x00, 0xe2, 0xe2, 0xe2, 0x00, 0xe3, 0xe3,
0xe3, 0x00, 0xe4, 0xe4, 0xe4, 0x00, 0xe5, 0xe5, 0xe5, 0x00, 0xe6, 0xe6,
0xe6, 0x00, 0xe7, 0xe7, 0xe7, 0x00, 0xe8, 0xe8, 0xe8, 0x00, 0xe9, 0xe9,
0xe9, 0x00, 0xea, 0xea, 0xea, 0x00, 0xeb, 0xeb, 0xeb, 0x00, 0xec, 0xec,
0xec, 0x00, 0xed, 0xed, 0xed, 0x00, 0xee, 0xee, 0xee, 0x00, 0xef, 0xef,
0xef, 0x00, 0xf0, 0xf0, 0xf0, 0x00, 0xf1, 0xf1, 0xf1, 0x00, 0xf2, 0xf2,
0xf2, 0x00, 0xf3, 0xf3, 0xf3, 0x00, 0xf4, 0xf4, 0xf4, 0x00, 0xf5, 0xf5,
0xf5, 0x00, 0xf6, 0xf6, 0xf6, 0x00, 0xf7, 0xf7, 0xf7, 0x00, 0xf8, 0xf8,
0xf8, 0x00, 0xf9, 0xf9, 0xf9, 0x00, 0xfa, 0xfa, 0xfa, 0x00, 0xfb, 0xfb,
0xfb, 0x00, 0xfc, 0xfc, 0xfc, 0x00, 0xfd, 0xfd, 0xfd, 0x00, 0xfe, 0xfe,
0xfe, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x2d, 0x2d, 0x2d, 0x2e, 0x31, 0x31, 0x31, 0x31, 0x2e, 0x2c, 0x2b,
0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x2c, 0x2d, 0x2f, 0x32, 0x35, 0x36, 0x38, 0x3b, 0x3e, 0x3e,
0x3f, 0x40, 0x40, 0x42, 0x3f, 0x36, 0x2d, 0x23, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2c, 0x2c, 0x2f, 0x31, 0x31, 0x32, 0x36, 0x39,
0x38, 0x36, 0x34, 0x33, 0x36, 0x3a, 0x3d, 0x3f, 0x3e, 0x43, 0x4c, 0x3d,
0x2c, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2c, 0x2e, 0x2e, 0x30,
0x34, 0x30, 0x21, 0x14, 0x0a, 0x05, 0x04, 0x04, 0x04, 0x08, 0x11, 0x1f,
0x30, 0x3a, 0x3a, 0x42, 0x48, 0x37, 0x2a, 0x29, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x2c, 0x2c,
0x2d, 0x2f, 0x30, 0x29, 0x12, 0x09, 0x15, 0x2e, 0x57, 0x7a, 0x91, 0x95,
0x89, 0x6d, 0x42, 0x1c, 0x0d, 0x10, 0x25, 0x34, 0x3a, 0x45, 0x3f, 0x35,
0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2c, 0x2c, 0x2c, 0x2f, 0x30, 0x25, 0x0f, 0x13, 0x47, 0x7a, 0xa4, 0xb2,
0xa8, 0x99, 0x8f, 0x8d, 0x95, 0xa3, 0xb3, 0xb9, 0x9a, 0x65, 0x2f, 0x0b,
0x21, 0x34, 0x3f, 0x43, 0x3b, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x2c, 0x2c, 0x2c, 0x30, 0x2e, 0x14, 0x0d, 0x47, 0x8e,
0x8d, 0x85, 0x7d, 0x7b, 0x7b, 0x7b, 0x7c, 0x7d, 0x7d, 0x7c, 0x7c, 0x7d,
0x88, 0x99, 0xa6, 0x8b, 0x1d, 0x0e, 0x2d, 0x3c, 0x44, 0x38, 0x2a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x2c, 0x2c, 0x2e, 0x2b, 0x0c,
0x18, 0x63, 0x87, 0x69, 0x75, 0x7c, 0x7b, 0x7a, 0x7a, 0x7a, 0x79, 0x79,
0x7a, 0x79, 0x7a, 0x7b, 0x7e, 0x7f, 0x7a, 0x91, 0xc2, 0x3f, 0x04, 0x28,
0x38, 0x47, 0x39, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x2c, 0x2b,
0x2e, 0x2c, 0x0f, 0x23, 0x5d, 0x69, 0x67, 0x7a, 0x7b, 0x7b, 0x7d, 0x80,
0x81, 0x81, 0x82, 0x81, 0x81, 0x81, 0x80, 0x7e, 0x7c, 0x7a, 0x7e, 0x7a,
0x7d, 0xc7, 0x67, 0x0b, 0x28, 0x38, 0x44, 0x3b, 0x2d, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2a, 0x2c, 0x2b, 0x30, 0x2e, 0x12, 0x25, 0x48, 0x57, 0x6d, 0x7a, 0x7c,
0x7e, 0x80, 0x81, 0x82, 0x81, 0x81, 0x81, 0x82, 0x81, 0x80, 0x80, 0x81,
0x81, 0x80, 0x7d, 0x7c, 0x7c, 0x79, 0xab, 0x74, 0x0c, 0x28, 0x3c, 0x42,
0x36, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2c, 0x2c, 0x2e, 0x32, 0x13, 0x20, 0x39, 0x50,
0x74, 0x7b, 0x7d, 0x80, 0x81, 0x81, 0x82, 0x83, 0x84, 0x83, 0x84, 0x84,
0x83, 0x82, 0x81, 0x81, 0x80, 0x7e, 0x80, 0x80, 0x7b, 0x80, 0x7d, 0xaa,
0x60, 0x06, 0x2e, 0x3f, 0x3f, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x2c, 0x2c, 0x31, 0x1e,
0x1a, 0x33, 0x44, 0x72, 0x7a, 0x7e, 0x7f, 0x81, 0x82, 0x84, 0x85, 0x86,
0x86, 0x87, 0x86, 0x86, 0x86, 0x84, 0x84, 0x83, 0x81, 0x81, 0x7e, 0x80,
0x7f, 0x7a, 0x80, 0x79, 0xc5, 0x34, 0x0f, 0x35, 0x44, 0x37, 0x1e, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c,
0x2b, 0x2e, 0x2d, 0x19, 0x2a, 0x35, 0x68, 0x7a, 0x7c, 0x7f, 0x82, 0x85,
0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8b, 0x8b, 0x8a, 0x89, 0x87, 0x86,
0x84, 0x82, 0x81, 0x80, 0x80, 0x7d, 0x7b, 0x7d, 0x80, 0xb7, 0x14, 0x24,
0x39, 0x47, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x2b, 0x2b, 0x2c, 0x31, 0x25, 0x23, 0x25, 0x55, 0x78, 0x7b,
0x7e, 0x81, 0x84, 0x87, 0x89, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x8f, 0x8e,
0x8e, 0x8d, 0x8c, 0x89, 0x87, 0x85, 0x82, 0x81, 0x80, 0x80, 0x7c, 0x7d,
0x79, 0x94, 0x74, 0x0c, 0x36, 0x3f, 0x3b, 0x25, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2c, 0x2d, 0x36, 0x1f, 0x22,
0x36, 0x72, 0x79, 0x7d, 0x81, 0x84, 0x88, 0x8b, 0x8c, 0x8f, 0x91, 0x91,
0x92, 0x94, 0x94, 0x94, 0x92, 0x91, 0x90, 0x8d, 0x8b, 0x88, 0x85, 0x82,
0x81, 0x80, 0x7f, 0x7a, 0x7f, 0x7a, 0x9c, 0x1f, 0x29, 0x37, 0x47, 0x2c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x2b,
0x33, 0x2f, 0x25, 0x1f, 0x59, 0x77, 0x7b, 0x7f, 0x84, 0x88, 0x8b, 0x8c,
0x90, 0x91, 0x93, 0x96, 0x97, 0x98, 0x98, 0x98, 0x97, 0x96, 0x94, 0x91,
0x8e, 0x8b, 0x88, 0x85, 0x81, 0x80, 0x81, 0x7d, 0x7a, 0x7d, 0x92, 0x4f,
0x12, 0x39, 0x3d, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x2a, 0x2c, 0x2b, 0x3b, 0x2b, 0x27, 0x2d, 0x6a, 0x79, 0x7d, 0x81,
0x86, 0x8a, 0x8e, 0x90, 0x93, 0x95, 0x98, 0x99, 0x9b, 0x9c, 0x9c, 0x9c,
0x9b, 0x99, 0x97, 0x94, 0x91, 0x8e, 0x8b, 0x87, 0x83, 0x81, 0x80, 0x7f,
0x7a, 0x7c, 0x83, 0x75, 0x0a, 0x33, 0x38, 0x3a, 0x29, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2d, 0x2f, 0x3d, 0x34, 0x22, 0x40,
0x71, 0x7b, 0x7f, 0x84, 0x89, 0x8c, 0x90, 0x92, 0x96, 0x98, 0x9b, 0x9c,
0x9f, 0xa0, 0xa0, 0xa0, 0x9f, 0x9d, 0x9b, 0x97, 0x94, 0x90, 0x8d, 0x88,
0x85, 0x82, 0x80, 0x80, 0x7c, 0x79, 0x79, 0x90, 0x14, 0x23, 0x38, 0x39,
0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2d, 0x34,
0x40, 0x3f, 0x1c, 0x4e, 0x74, 0x7c, 0x80, 0x86, 0x8a, 0x8f, 0x91, 0x95,
0x98, 0x9b, 0x9e, 0xa0, 0xa2, 0xa4, 0xa5, 0xa5, 0xa4, 0xa1, 0x9d, 0x9b,
0x96, 0x93, 0x8f, 0x8b, 0x87, 0x83, 0x82, 0x80, 0x7d, 0x79, 0x75, 0x91,
0x24, 0x17, 0x38, 0x36, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x2a, 0x2e, 0x38, 0x4b, 0x44, 0x1c, 0x56, 0x77, 0x7d, 0x81, 0x87,
0x8d, 0x90, 0x93, 0x96, 0x99, 0x9d, 0xa0, 0xa3, 0xa5, 0xa7, 0xa7, 0xa7,
0xa6, 0xa4, 0xa0, 0x9d, 0x99, 0x94, 0x91, 0x8c, 0x87, 0x84, 0x82, 0x81,
0x7e, 0x7a, 0x73, 0x88, 0x34, 0x0e, 0x37, 0x34, 0x2d, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x2f, 0x3b, 0x5e, 0x45, 0x1d, 0x5b,
0x78, 0x7d, 0x82, 0x88, 0x8e, 0x91, 0x94, 0x97, 0x9b, 0x9e, 0xa2, 0xa5,
0xa8, 0xaa, 0xab, 0xab, 0xa9, 0xa6, 0xa3, 0x9f, 0x9a, 0x96, 0x92, 0x8d,
0x89, 0x86, 0x82, 0x81, 0x7e, 0x7b, 0x73, 0x77, 0x3d, 0x0b, 0x35, 0x32,
0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x31, 0x3c,
0x79, 0x4a, 0x1d, 0x5f, 0x79, 0x7e, 0x82, 0x89, 0x8e, 0x92, 0x95, 0x98,
0x9c, 0x9f, 0xa2, 0xa6, 0xa9, 0xac, 0xaf, 0xaf, 0xab, 0xa8, 0xa5, 0xa0,
0x9c, 0x97, 0x94, 0x8f, 0x8a, 0x87, 0x83, 0x82, 0x7f, 0x7a, 0x73, 0x64,
0x3e, 0x0b, 0x32, 0x31, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x36, 0x35, 0x3f, 0x96, 0x56, 0x1c, 0x60, 0x78, 0x7d, 0x82, 0x8a,
0x8e, 0x92, 0x96, 0x99, 0x9c, 0x9f, 0xa2, 0xa6, 0xa9, 0xac, 0xae, 0xaf,
0xab, 0xa8, 0xa5, 0xa0, 0x9c, 0x99, 0x94, 0x90, 0x8b, 0x88, 0x83, 0x81,
0x7f, 0x7a, 0x73, 0x5b, 0x37, 0x0d, 0x33, 0x30, 0x2d, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x3b, 0x47, 0xac, 0x71, 0x1a, 0x66,
0x77, 0x7d, 0x82, 0x89, 0x8f, 0x92, 0x95, 0x99, 0x9c, 0x9f, 0xa2, 0xa5,
0xa8, 0xab, 0xac, 0xac, 0xaa, 0xa7, 0xa4, 0xa0, 0x9c, 0x98, 0x94, 0x90,
0x8b, 0x88, 0x83, 0x82, 0x7e, 0x7a, 0x71, 0x50, 0x2f, 0x0e, 0x34, 0x2f,
0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x3f, 0x4d,
0xa4, 0xa2, 0x15, 0x6c, 0x76, 0x7c, 0x80, 0x88, 0x8e, 0x92, 0x95, 0x98,
0x9b, 0x9e, 0xa1, 0xa4, 0xa6, 0xa8, 0xa9, 0xa9, 0xa8, 0xa6, 0xa2, 0x9f,
0x9b, 0x97, 0x93, 0x8f, 0x8b, 0x88, 0x84, 0x81, 0x7e, 0x79, 0x6d, 0x45,
0x24, 0x13, 0x35, 0x2e, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x4b, 0x45, 0x58, 0x88, 0xd9, 0x18, 0x79, 0x73, 0x7c, 0x7f, 0x87,
0x8c, 0x91, 0x95, 0x98, 0x99, 0x9d, 0xa0, 0xa1, 0xa4, 0xa5, 0xa7, 0xa7,
0xa5, 0xa3, 0xa0, 0x9e, 0x9a, 0x97, 0x93, 0x8f, 0x8b, 0x86, 0x84, 0x81,
0x7d, 0x79, 0x64, 0x39, 0x1b, 0x1b, 0x34, 0x2d, 0x2d, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x53, 0x6d, 0x70, 0xef, 0x3a, 0x6f,
0x81, 0x78, 0x7e, 0x83, 0x8b, 0x90, 0x93, 0x95, 0x98, 0x9b, 0x9d, 0xa0,
0xa1, 0xa3, 0xa3, 0xa3, 0xa2, 0xa0, 0x9f, 0x9c, 0x98, 0x95, 0x91, 0x8d,
0x89, 0x86, 0x82, 0x7f, 0x7b, 0x77, 0x54, 0x2f, 0x13, 0x29, 0x30, 0x2c,
0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x67, 0x70,
0x77, 0xd8, 0x81, 0x40, 0xa7, 0x71, 0x7c, 0x80, 0x88, 0x8d, 0x92, 0x94,
0x97, 0x99, 0x9c, 0x9d, 0x9e, 0x9f, 0x9f, 0x9f, 0x9f, 0x9e, 0x9c, 0x99,
0x96, 0x93, 0x90, 0x8c, 0x89, 0x85, 0x81, 0x7e, 0x7a, 0x75, 0x3b, 0x26,
0x11, 0x34, 0x2c, 0x2c, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x79, 0x66, 0x8d, 0xaa, 0xcb, 0x27, 0xac, 0x81, 0x78, 0x7f,
0x83, 0x8a, 0x8f, 0x92, 0x96, 0x97, 0x99, 0x9a, 0x9c, 0x9c, 0x9c, 0x9c,
0x9c, 0x9a, 0x99, 0x97, 0x94, 0x92, 0x8e, 0x8b, 0x87, 0x83, 0x80, 0x7c,
0x7a, 0x63, 0x26, 0x1f, 0x20, 0x32, 0x2c, 0x2c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x74, 0x9c, 0x8e, 0xec, 0x50,
0x69, 0xb2, 0x75, 0x7b, 0x80, 0x86, 0x8b, 0x8f, 0x92, 0x95, 0x97, 0x98,
0x99, 0x9a, 0x9b, 0x9b, 0x99, 0x98, 0x96, 0x94, 0x92, 0x8f, 0x8d, 0x89,
0x85, 0x81, 0x7d, 0x7a, 0x75, 0x39, 0x21, 0x1b, 0x32, 0x2d, 0x2b, 0x2c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x91,
0x8e, 0xa5, 0xc3, 0xc2, 0x21, 0xa7, 0x95, 0x77, 0x7d, 0x81, 0x87, 0x8b,
0x90, 0x92, 0x94, 0x95, 0x96, 0x97, 0x97, 0x97, 0x96, 0x95, 0x93, 0x91,
0x8f, 0x8d, 0x8a, 0x86, 0x82, 0x7e, 0x7b, 0x78, 0x55, 0x1d, 0x25, 0x26,
0x32, 0x2c, 0x2c, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xa7, 0x8f, 0xac, 0xa0, 0xf1, 0x7f, 0x3c, 0xb7, 0x83,
0x79, 0x7c, 0x81, 0x87, 0x8a, 0x8e, 0x90, 0x92, 0x93, 0x93, 0x94, 0x94,
0x93, 0x91, 0x90, 0x8e, 0x8c, 0x89, 0x86, 0x82, 0x7d, 0x7b, 0x78, 0x64,
0x25, 0x25, 0x29, 0x31, 0x2e, 0x2b, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xa8, 0xa1, 0xa7, 0xb5,
0xfb, 0x54, 0x6b, 0xba, 0x7a, 0x79, 0x7a, 0x80, 0x86, 0x88, 0x8c, 0x8d,
0x8f, 0x90, 0x8f, 0x8f, 0x8f, 0x8d, 0x8d, 0x8b, 0x88, 0x85, 0x81, 0x7e,
0x7a, 0x77, 0x6a, 0x32, 0x1f, 0x33, 0x2f, 0x33, 0x2c, 0x2c, 0x2c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb7, 0xa8, 0xb7, 0x94, 0xcf, 0xe7, 0x43, 0x83, 0xbb, 0x86, 0x79, 0x78,
0x7d, 0x82, 0x85, 0x86, 0x89, 0x8a, 0x8b, 0x8b, 0x8a, 0x88, 0x87, 0x84,
0x83, 0x7f, 0x7b, 0x7a, 0x77, 0x67, 0x37, 0x1a, 0x3a, 0x38, 0x38, 0x2d,
0x2c, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc7, 0xb3, 0xaa, 0xb7, 0x92, 0xd2, 0xd6, 0x45,
0x6a, 0xb8, 0x9c, 0x7b, 0x77, 0x7c, 0x7d, 0x80, 0x81, 0x82, 0x83, 0x83,
0x82, 0x81, 0x80, 0x7e, 0x7c, 0x7c, 0x79, 0x73, 0x5b, 0x2c, 0x18, 0x42,
0x4a, 0x3b, 0x2e, 0x2b, 0x2c, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xad, 0xa9,
0xb9, 0x99, 0xd1, 0xea, 0x5f, 0x3e, 0xab, 0xb7, 0x8e, 0x75, 0x78, 0x7d,
0x7e, 0x7f, 0x7f, 0x7f, 0x7e, 0x7e, 0x7d, 0x7b, 0x79, 0x73, 0x67, 0x45,
0x1a, 0x1d, 0x5c, 0x63, 0x41, 0x2e, 0x2b, 0x2c, 0x2c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xbc, 0xb0, 0xa3, 0xba, 0x92, 0xcc, 0xfd, 0x90, 0x2a, 0x7d,
0xb6, 0xb7, 0x96, 0x7e, 0x78, 0x79, 0x7a, 0x7a, 0x79, 0x76, 0x73, 0x71,
0x66, 0x4c, 0x25, 0x12, 0x3a, 0x8f, 0x85, 0x44, 0x2f, 0x2c, 0x2b, 0x2c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xb1, 0xa9, 0xb8, 0x94,
0xb1, 0xf0, 0xd6, 0x60, 0x47, 0x66, 0x8b, 0xa2, 0xa8, 0xa0, 0x9b, 0x91,
0x83, 0x74, 0x5a, 0x39, 0x1c, 0x18, 0x40, 0x8f, 0xc8, 0x8e, 0x3d, 0x2e,
0x2c, 0x2b, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xbd, 0xae, 0xab, 0xb8, 0xaa, 0x9e, 0xbb, 0xf0, 0xdc, 0xa2, 0x6c, 0x45,
0x35, 0x31, 0x31, 0x2a, 0x1f, 0x16, 0x1e, 0x43, 0x80, 0xbf, 0xd8, 0xb0,
0x64, 0x36, 0x2c, 0x2b, 0x2c, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0xb5, 0xab, 0xaa, 0xb9, 0xad, 0x8f,
0xa6, 0xdd, 0xf5, 0xf6, 0xe6, 0xcf, 0xbc, 0xb9, 0xc4, 0xd8, 0xee, 0xf7,
0xe4, 0xaa, 0x6b, 0x42, 0x2f, 0x2e, 0x2d, 0x2b, 0x2b, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc1,
0xb2, 0x9f, 0xb1, 0xc2, 0xae, 0x8e, 0x8e, 0xa7, 0xbf, 0xd0, 0xd8, 0xd9,
0xd4, 0xc4, 0xa8, 0x84, 0x61, 0x45, 0x30, 0x2c, 0x31, 0x2d, 0x28, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xca, 0xbe, 0xaa, 0x9b, 0xaf, 0xbd, 0xb8, 0xa6,
0x98, 0x8f, 0x89, 0x82, 0x73, 0x66, 0x59, 0x47, 0x37, 0x2f, 0x37, 0x34,
0x2d, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0xc0,
0xb4, 0xa7, 0xa5, 0xa4, 0xa0, 0x97, 0x8e, 0x81, 0x68, 0x56, 0x47, 0x43,
0x42, 0x3b, 0x31, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0xc4, 0xb7, 0xa7, 0x9b, 0x8e, 0x80,
0x6f, 0x60, 0x52, 0x47, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
};
unsigned int gamepad_button_bmp_len = 3746;
+13624
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

+57 -99
View File
@@ -13,13 +13,12 @@
/* Gamepad mapping generator */
/* Gabriel Jacobo <gabomdq@gmail.com> */
#include <stdio.h>
#include <stdlib.h>
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_test.h>
#include "testutils.h"
#include "gamepadutils.h"
/* Define this for verbose output while mapping gamepads */
#define DEBUG_GAMEPADMAP
@@ -27,12 +26,6 @@
#define SCREEN_WIDTH 512
#define SCREEN_HEIGHT 320
enum marker_type
{
MARKER_BUTTON,
MARKER_AXIS,
};
enum
{
SDL_GAMEPAD_BINDING_AXIS_LEFTX_NEGATIVE,
@@ -50,47 +43,6 @@ enum
#define BINDING_COUNT (SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BINDING_AXIS_MAX)
static struct
{
int x, y;
double angle;
enum marker_type marker;
} s_arrBindingDisplay[] = {
{ 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_GAMEPAD_BUTTON_A,
SDL_GAMEPAD_BUTTON_B,
@@ -171,6 +123,7 @@ static SDL_bool s_bBindingComplete;
static SDL_Window *window;
static SDL_Renderer *screen;
static GamepadImage *image;
static SDL_bool done = SDL_FALSE;
static SDL_bool bind_touchpad = SDL_FALSE;
@@ -189,8 +142,9 @@ StandardizeAxisValue(int nValue)
static void
SetCurrentBinding(int iBinding)
{
int iIndex;
int iIndex, iElement;
SDL_GameControllerExtendedBind *pBinding;
SDL_bool on_front;
if (iBinding < 0) {
return;
@@ -221,6 +175,53 @@ SetCurrentBinding(int iBinding)
s_arrAxisState[iIndex].m_nFarthestValue = s_arrAxisState[iIndex].m_nStartingValue;
}
iElement = s_arrBindingOrder[iBinding];
on_front = SDL_TRUE;
if (iElement >= SDL_GAMEPAD_BUTTON_PADDLE1 &&
iElement <= SDL_GAMEPAD_BUTTON_PADDLE4) {
on_front = SDL_FALSE;
}
SetGamepadImageShowingFront(image, on_front);
ClearGamepadImage(image);
if (iElement < SDL_GAMEPAD_BUTTON_MAX) {
SDL_GamepadButton eButton = (SDL_GamepadButton)iElement;
SetGamepadImageButton(image, eButton, SDL_TRUE);
} else {
switch (iElement - SDL_GAMEPAD_BUTTON_MAX) {
case SDL_GAMEPAD_BINDING_AXIS_LEFTX_NEGATIVE:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_LEFTX, -1);
break;
case SDL_GAMEPAD_BINDING_AXIS_LEFTX_POSITIVE:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_LEFTX, 1);
break;
case SDL_GAMEPAD_BINDING_AXIS_LEFTY_NEGATIVE:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_LEFTY, -1);
break;
case SDL_GAMEPAD_BINDING_AXIS_LEFTY_POSITIVE:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_LEFTY, 1);
break;
case SDL_GAMEPAD_BINDING_AXIS_RIGHTX_NEGATIVE:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_RIGHTX, -1);
break;
case SDL_GAMEPAD_BINDING_AXIS_RIGHTX_POSITIVE:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_RIGHTX, 1);
break;
case SDL_GAMEPAD_BINDING_AXIS_RIGHTY_NEGATIVE:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_RIGHTY, -1);
break;
case SDL_GAMEPAD_BINDING_AXIS_RIGHTY_POSITIVE:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_RIGHTY, 1);
break;
case SDL_GAMEPAD_BINDING_AXIS_TRIGGERLEFT:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, 1);
break;
case SDL_GAMEPAD_BINDING_AXIS_TRIGGERRIGHT:
SetGamepadImageAxis(image, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, 1);
break;
}
}
s_unPendingAdvanceTime = 0;
}
@@ -351,19 +352,12 @@ BMergeAxisBindings(int iIndex)
static void
WatchJoystick(SDL_Joystick *joystick)
{
SDL_Texture *background_front, *background_back, *button, *axis, *marker = NULL;
const char *name = NULL;
SDL_Event event;
SDL_FRect dst;
int texture_w, texture_h;
Uint8 alpha = 200, alpha_step = -1;
Uint64 alpha_ticks = 0;
SDL_JoystickID nJoystickID;
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);
image = CreateGamepadImage(screen);
SDL_RaiseWindow(window);
/* scale for platforms that don't give you the window size you asked for. */
@@ -396,47 +390,13 @@ WatchJoystick(SDL_Joystick *joystick)
while (SDL_PollEvent(&event) > 0) {
}
SetCurrentBinding(0);
/* Loop, getting joystick events! */
while (!done && !s_bBindingComplete) {
int iElement = s_arrBindingOrder[s_iCurrentBinding];
switch (s_arrBindingDisplay[iElement].marker) {
case MARKER_AXIS:
marker = axis;
break;
case MARKER_BUTTON:
marker = button;
break;
}
SDL_QueryTexture(marker, NULL, NULL, &texture_w, &texture_h);
dst.x = (float)s_arrBindingDisplay[iElement].x;
dst.y = (float)s_arrBindingDisplay[iElement].y;
dst.w = (float)texture_w;
dst.h = (float)texture_h;
if (SDL_GetTicks() >= (alpha_ticks + 5)) {
alpha_ticks = SDL_GetTicks();
alpha += alpha_step;
if (alpha == 255) {
alpha_step = -1;
}
if (alpha < 128) {
alpha_step = 1;
}
}
SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE);
SDL_RenderClear(screen);
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);
}
SDL_SetTextureAlphaMod(marker, alpha);
SDL_SetTextureColorMod(marker, 10, 255, 21);
SDL_RenderTextureRotated(screen, marker, NULL, &dst, s_arrBindingDisplay[iElement].angle, NULL, SDL_FLIP_NONE);
RenderGamepadImage(image);
SDL_RenderPresent(screen);
while (SDL_PollEvent(&event) > 0) {
@@ -696,8 +656,6 @@ WatchJoystick(SDL_Joystick *joystick)
}
SDL_Log("Mapping:\n\n%s\n\n", mapping);
/* Print to stdout as well so the user can cat the output somewhere */
printf("%s\n", mapping);
}
SDL_free(s_arrAxisState);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 KiB

+413
View File
@@ -0,0 +1,413 @@
/*
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
*/
#include <SDL3/SDL.h>
#include "gamepadutils.h"
#include "gamepad_front.h"
#include "gamepad_back.h"
#include "gamepad_button.h"
#include "gamepad_axis.h"
/* This is indexed by SDL_GamepadButton. */
static const struct
{
int x;
int y;
} button_positions[] = {
{ 412, 192 }, /* SDL_GAMEPAD_BUTTON_A */
{ 456, 157 }, /* SDL_GAMEPAD_BUTTON_B */
{ 367, 157 }, /* SDL_GAMEPAD_BUTTON_X */
{ 414, 126 }, /* SDL_GAMEPAD_BUTTON_Y */
{ 199, 157 }, /* SDL_GAMEPAD_BUTTON_BACK */
{ 257, 153 }, /* SDL_GAMEPAD_BUTTON_GUIDE */
{ 314, 157 }, /* SDL_GAMEPAD_BUTTON_START */
{ 100, 179 }, /* SDL_GAMEPAD_BUTTON_LEFT_STICK */
{ 330, 255 }, /* SDL_GAMEPAD_BUTTON_RIGHT_STICK */
{ 102, 65 }, /* SDL_GAMEPAD_BUTTON_LEFT_SHOULDER */
{ 421, 61 }, /* SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER */
{ 179, 213 }, /* SDL_GAMEPAD_BUTTON_DPAD_UP */
{ 179, 274 }, /* SDL_GAMEPAD_BUTTON_DPAD_DOWN */
{ 141, 242 }, /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */
{ 211, 242 }, /* SDL_GAMEPAD_BUTTON_DPAD_RIGHT */
{ 257, 199 }, /* SDL_GAMEPAD_BUTTON_MISC1 */
{ 157, 160 }, /* SDL_GAMEPAD_BUTTON_PADDLE1 */
{ 355, 160 }, /* SDL_GAMEPAD_BUTTON_PADDLE2 */
{ 157, 200 }, /* SDL_GAMEPAD_BUTTON_PADDLE3 */
{ 355, 200 }, /* SDL_GAMEPAD_BUTTON_PADDLE4 */
};
/* This is indexed by SDL_GamepadAxis. */
static const struct
{
int x;
int y;
double angle;
} axis_positions[] = {
{ 99, 178, 270.0 }, /* LEFTX */
{ 99, 178, 0.0 }, /* LEFTY */
{ 331, 256, 270.0 }, /* RIGHTX */
{ 331, 256, 0.0 }, /* RIGHTY */
{ 116, 5, 0.0 }, /* TRIGGERLEFT */
{ 400, 5, 0.0 }, /* TRIGGERRIGHT */
};
struct GamepadImage
{
SDL_Renderer *renderer;
SDL_Texture *front_texture;
SDL_Texture *back_texture;
SDL_Texture *button_texture;
SDL_Texture *axis_texture;
int gamepad_width;
int gamepad_height;
int button_width;
int button_height;
int axis_width;
int axis_height;
int x;
int y;
SDL_bool showing_front;
SDL_bool buttons[SDL_GAMEPAD_BUTTON_MAX];
int axes[SDL_GAMEPAD_AXIS_MAX];
};
static SDL_Texture *CreateTexture(SDL_Renderer *renderer, unsigned char *data, unsigned int len)
{
SDL_Texture *texture = NULL;
SDL_Surface *surface;
SDL_RWops *src = SDL_RWFromConstMem(data, len);
if (src) {
surface = SDL_LoadBMP_RW(src, SDL_TRUE);
if (surface) {
if (surface->format->palette) {
SDL_SetSurfaceColorKey(surface, SDL_TRUE, *(Uint8 *)surface->pixels);
} else {
switch (surface->format->BitsPerPixel) {
case 15:
SDL_SetSurfaceColorKey(surface, SDL_TRUE,
(*(Uint16 *)surface->pixels) & 0x00007FFF);
break;
case 16:
SDL_SetSurfaceColorKey(surface, SDL_TRUE, *(Uint16 *)surface->pixels);
break;
case 24:
SDL_SetSurfaceColorKey(surface, SDL_TRUE,
(*(Uint32 *)surface->pixels) & 0x00FFFFFF);
break;
case 32:
SDL_SetSurfaceColorKey(surface, SDL_TRUE, *(Uint32 *)surface->pixels);
break;
}
}
texture = SDL_CreateTextureFromSurface(renderer, surface);
SDL_DestroySurface(surface);
}
}
return texture;
}
GamepadImage *CreateGamepadImage(SDL_Renderer *renderer)
{
GamepadImage *ctx = SDL_calloc(1, sizeof(*ctx));
if (ctx) {
ctx->renderer = renderer;
ctx->front_texture = CreateTexture(renderer, gamepad_front_bmp, gamepad_front_bmp_len);
ctx->back_texture = CreateTexture(renderer, gamepad_back_bmp, gamepad_back_bmp_len);
SDL_QueryTexture(ctx->front_texture, NULL, NULL, &ctx->gamepad_width, &ctx->gamepad_height);
ctx->button_texture = CreateTexture(renderer, gamepad_button_bmp, gamepad_button_bmp_len);
SDL_QueryTexture(ctx->button_texture, NULL, NULL, &ctx->button_width, &ctx->button_height);
SDL_SetTextureColorMod(ctx->button_texture, 10, 255, 21);
ctx->axis_texture = CreateTexture(renderer, gamepad_axis_bmp, gamepad_axis_bmp_len);
SDL_QueryTexture(ctx->axis_texture, NULL, NULL, &ctx->axis_width, &ctx->axis_height);
SDL_SetTextureColorMod(ctx->axis_texture, 10, 255, 21);
ctx->showing_front = SDL_TRUE;
}
return ctx;
}
void SetGamepadImagePosition(GamepadImage *ctx, int x, int y)
{
if (!ctx) {
return;
}
ctx->x = x;
ctx->y = y;
}
void SetGamepadImageShowingFront(GamepadImage *ctx, SDL_bool showing_front)
{
if (!ctx) {
return;
}
ctx->showing_front = showing_front;
}
void GetGamepadImageArea(GamepadImage *ctx, int *x, int *y, int *width, int *height)
{
if (!ctx) {
if (x) {
*x = 0;
}
if (y) {
*y = 0;
}
if (width) {
*width = 0;
}
if (height) {
*height = 0;
}
return;
}
if (x) {
*x = ctx->x;
}
if (y) {
*y = ctx->y;
}
if (width) {
*width = ctx->gamepad_width;
}
if (height) {
*height = ctx->gamepad_height;
}
}
int GetGamepadImageButtonWidth(GamepadImage *ctx)
{
if (!ctx) {
return 0;
}
return ctx->button_width;
}
int GetGamepadImageButtonHeight(GamepadImage *ctx)
{
if (!ctx) {
return 0;
}
return ctx->button_height;
}
int GetGamepadImageAxisWidth(GamepadImage *ctx)
{
if (!ctx) {
return 0;
}
return ctx->axis_width;
}
int GetGamepadImageAxisHeight(GamepadImage *ctx)
{
if (!ctx) {
return 0;
}
return ctx->axis_height;
}
SDL_GamepadButton GetGamepadImageButtonAt(GamepadImage *ctx, float x, float y)
{
SDL_FPoint point;
int i;
if (!ctx) {
return SDL_GAMEPAD_BUTTON_INVALID;
}
point.x = x;
point.y = y;
for (i = 0; i < SDL_arraysize(button_positions); ++i) {
SDL_bool on_front = SDL_TRUE;
if (i >= SDL_GAMEPAD_BUTTON_PADDLE1 && i <= SDL_GAMEPAD_BUTTON_PADDLE4) {
on_front = SDL_FALSE;
}
if (on_front == ctx->showing_front) {
SDL_FRect rect;
rect.x = (float)ctx->x + button_positions[i].x - ctx->button_width / 2;
rect.y = (float)ctx->y + button_positions[i].y - ctx->button_height / 2;
rect.w = (float)ctx->button_width;
rect.h = (float)ctx->button_height;
if (SDL_PointInRectFloat(&point, &rect)) {
return (SDL_GamepadButton)i;
}
}
}
return SDL_GAMEPAD_BUTTON_INVALID;
}
SDL_GamepadAxis GetGamepadImageAxisAt(GamepadImage *ctx, float x, float y)
{
SDL_FPoint point;
int i;
if (!ctx) {
return SDL_GAMEPAD_AXIS_INVALID;
}
point.x = x;
point.y = y;
if (ctx->showing_front) {
for (i = 0; i < SDL_arraysize(axis_positions); ++i) {
SDL_FRect rect;
rect.x = (float)ctx->x + axis_positions[i].x - ctx->axis_width / 2;
rect.y = (float)ctx->y + axis_positions[i].y - ctx->axis_height / 2;
rect.w = (float)ctx->axis_width;
rect.h = (float)ctx->axis_height;
if (SDL_PointInRectFloat(&point, &rect)) {
return (SDL_GamepadAxis)i;
}
}
}
return SDL_GAMEPAD_AXIS_INVALID;
}
void ClearGamepadImage(GamepadImage *ctx)
{
if (!ctx) {
return;
}
SDL_zeroa(ctx->buttons);
SDL_zeroa(ctx->axes);
}
void SetGamepadImageButton(GamepadImage *ctx, SDL_GamepadButton button, SDL_bool active)
{
if (!ctx) {
return;
}
ctx->buttons[button] = active;
}
void SetGamepadImageAxis(GamepadImage *ctx, SDL_GamepadAxis axis, int direction)
{
if (!ctx) {
return;
}
ctx->axes[axis] = direction;
}
void UpdateGamepadImageFromGamepad(GamepadImage *ctx, SDL_Gamepad *gamepad)
{
int i;
if (!ctx) {
return;
}
for (i = 0; i < SDL_GAMEPAD_BUTTON_TOUCHPAD; ++i) {
const SDL_GamepadButton button = (SDL_GamepadButton)i;
if (SDL_GetGamepadButton(gamepad, button) == SDL_PRESSED) {
SetGamepadImageButton(ctx, button, SDL_TRUE);
} else {
SetGamepadImageButton(ctx, button, SDL_FALSE);
}
}
for (i = 0; i < SDL_GAMEPAD_AXIS_MAX; ++i) {
const SDL_GamepadAxis axis = (SDL_GamepadAxis)i;
const Sint16 deadzone = 8000; /* !!! FIXME: real deadzone */
const Sint16 value = SDL_GetGamepadAxis(gamepad, axis);
if (value < -deadzone) {
SetGamepadImageAxis(ctx, axis, -1);
} else if (value > deadzone) {
SetGamepadImageAxis(ctx, axis, 1);
} else {
SetGamepadImageAxis(ctx, axis, 0);
}
}
}
void RenderGamepadImage(GamepadImage *ctx)
{
SDL_FRect dst;
int i;
if (!ctx) {
return;
}
dst.x = (float)ctx->x;
dst.y = (float)ctx->y;
dst.w = (float)ctx->gamepad_width;
dst.h = (float)ctx->gamepad_height;
if (ctx->showing_front) {
SDL_RenderTexture(ctx->renderer, ctx->front_texture, NULL, &dst);
} else {
SDL_RenderTexture(ctx->renderer, ctx->back_texture, NULL, &dst);
}
for (i = 0; i < SDL_arraysize(button_positions); ++i) {
if (ctx->buttons[i]) {
SDL_bool on_front = SDL_TRUE;
if (i >= SDL_GAMEPAD_BUTTON_PADDLE1 && i <= SDL_GAMEPAD_BUTTON_PADDLE4) {
on_front = SDL_FALSE;
}
if (on_front == ctx->showing_front) {
dst.x = (float)ctx->x + button_positions[i].x - ctx->button_width / 2;
dst.y = (float)ctx->y + button_positions[i].y - ctx->button_height / 2;
dst.w = (float)ctx->button_width;
dst.h = (float)ctx->button_height;
SDL_RenderTexture(ctx->renderer, ctx->button_texture, NULL, &dst);
}
}
}
if (ctx->showing_front) {
for (i = 0; i < SDL_arraysize(axis_positions); ++i) {
if (ctx->axes[i] < 0) {
const double angle = axis_positions[i].angle;
dst.x = (float)ctx->x + axis_positions[i].x - ctx->axis_width / 2;
dst.y = (float)ctx->y + axis_positions[i].y - ctx->axis_height / 2;
dst.w = (float)ctx->axis_width;
dst.h = (float)ctx->axis_height;
SDL_RenderTextureRotated(ctx->renderer, ctx->axis_texture, NULL, &dst, angle, NULL, SDL_FLIP_NONE);
} else if (ctx->axes[i] > 0) {
const double angle = axis_positions[i].angle + 180.0;
dst.x = (float)ctx->x + axis_positions[i].x - ctx->axis_width / 2;
dst.y = (float)ctx->y + axis_positions[i].y - ctx->axis_height / 2;
dst.w = (float)ctx->axis_width;
dst.h = (float)ctx->axis_height;
SDL_RenderTextureRotated(ctx->renderer, ctx->axis_texture, NULL, &dst, angle, NULL, SDL_FLIP_NONE);
}
}
}
}
void DestroyGamepadImage(GamepadImage *ctx)
{
if (ctx) {
SDL_DestroyTexture(ctx->front_texture);
SDL_DestroyTexture(ctx->back_texture);
SDL_DestroyTexture(ctx->button_texture);
SDL_DestroyTexture(ctx->axis_texture);
SDL_free(ctx);
}
}
+54
View File
@@ -0,0 +1,54 @@
/*
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
*/
/* Joystick element display */
typedef struct JoystickDisplay JoystickDisplay;
extern JoystickDisplay *CreateJoystickDisplay(SDL_Renderer *renderer);
extern void SetJoystickDisplayArea(JoystickDisplay *ctx, int x, int y, int w, int h);
extern void UpdateJoystickDisplayFromJoystick(JoystickDisplay *ctx, SDL_Joystick *joystick);
extern void RenderJoystickDisplay(JoystickDisplay *ctx);
/* Gamepad element display */
typedef struct GamepadDisplay GamepadDisplay;
extern GamepadDisplay *CreateGamepadDisplay(SDL_Renderer *renderer);
extern void SetGamepadDisplayArea(GamepadDisplay *ctx, int x, int y, int w, int h);
extern void UpdateGamepadDisplayFromGamepad(GamepadDisplay *ctx, SDL_Gamepad *joystick);
extern void RenderGamepadDisplay(GamepadDisplay *ctx);
/* Gamepad image */
typedef struct GamepadImage GamepadImage;
extern GamepadImage *CreateGamepadImage(SDL_Renderer *renderer);
extern void SetGamepadImagePosition(GamepadImage *ctx, int x, int y);
extern void SetGamepadImageShowingFront(GamepadImage *ctx, SDL_bool showing_front);
extern void GetGamepadImageArea(GamepadImage *ctx, int *x, int *y, int *width, int *height);
extern int GetGamepadImageButtonWidth(GamepadImage *ctx);
extern int GetGamepadImageButtonHeight(GamepadImage *ctx);
extern int GetGamepadImageAxisWidth(GamepadImage *ctx);
extern int GetGamepadImageAxisHeight(GamepadImage *ctx);
extern SDL_GamepadButton GetGamepadImageButtonAt(GamepadImage *ctx, float x, float y);
extern SDL_GamepadAxis GetGamepadImageAxisAt(GamepadImage *ctx, float x, float y);
extern void ClearGamepadImage(GamepadImage *ctx);
extern void SetGamepadImageButton(GamepadImage *ctx, SDL_GamepadButton button, SDL_bool active);
extern void SetGamepadImageAxis(GamepadImage *ctx, SDL_GamepadAxis axis, int direction);
extern void UpdateGamepadImageFromGamepad(GamepadImage *ctx, SDL_Gamepad *gamepad);
extern void RenderGamepadImage(GamepadImage *ctx);
extern void DestroyGamepadImage(GamepadImage *ctx);
+14 -143
View File
@@ -15,6 +15,8 @@
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_test.h>
#include "gamepadutils.h"
#include "testutils.h"
#ifdef __EMSCRIPTEN__
@@ -24,55 +26,6 @@
#define SCREEN_WIDTH 512
#define SCREEN_HEIGHT 320
#define BUTTON_SIZE 50
#define AXIS_SIZE 50
/* This is indexed by SDL_GamepadButton. */
static const struct
{
int x;
int y;
} button_positions[] = {
{ 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_GAMEPAD_BUTTON_MAX);
/* This is indexed by SDL_GamepadAxis. */
static const struct
{
int x;
int y;
double angle;
} axis_positions[] = {
{ 74, 153, 270.0 }, /* LEFTX */
{ 74, 153, 0.0 }, /* LEFTY */
{ 306, 231, 270.0 }, /* RIGHTX */
{ 306, 231, 0.0 }, /* RIGHTY */
{ 91, -20, 0.0 }, /* TRIGGERLEFT */
{ 375, -20, 0.0 }, /* TRIGGERRIGHT */
};
SDL_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[] = {
"unknown", /* SDL_JOYSTICK_POWER_UNKNOWN */
@@ -86,11 +39,11 @@ SDL_COMPILE_TIME_ASSERT(power_level_strings, SDL_arraysize(power_level_strings)
static SDL_Window *window = NULL;
static SDL_Renderer *screen = NULL;
static GamepadImage *image = NULL;
static SDL_bool retval = SDL_FALSE;
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_Gamepad *gamepad;
static SDL_Gamepad **gamepads;
static int num_gamepads = 0;
@@ -494,49 +447,12 @@ static void CloseVirtualGamepad(void)
static SDL_GamepadButton FindButtonAtPosition(float x, float y)
{
SDL_FPoint point;
int i;
SDL_bool showing_front = ShowingFront();
point.x = x;
point.y = y;
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_FRect rect;
rect.x = (float)button_positions[i].x;
rect.y = (float)button_positions[i].y;
rect.w = (float)BUTTON_SIZE;
rect.h = (float)BUTTON_SIZE;
if (SDL_PointInRectFloat(&point, &rect)) {
return (SDL_GamepadButton)i;
}
}
}
return SDL_GAMEPAD_BUTTON_INVALID;
return GetGamepadImageButtonAt(image, x, y);
}
static SDL_GamepadAxis FindAxisAtPosition(float x, float y)
{
SDL_FPoint point;
int i;
SDL_bool showing_front = ShowingFront();
point.x = x;
point.y = y;
for (i = 0; i < SDL_GAMEPAD_AXIS_MAX; ++i) {
if (showing_front) {
SDL_FRect rect;
rect.x = (float)axis_positions[i].x;
rect.y = (float)axis_positions[i].y;
rect.w = (float)AXIS_SIZE;
rect.h = (float)AXIS_SIZE;
if (SDL_PointInRectFloat(&point, &rect)) {
return (SDL_GamepadAxis)i;
}
}
}
return SDL_GAMEPAD_AXIS_INVALID;
return GetGamepadImageAxisAt(image, x, y);
}
static void VirtualGamepadMouseMotion(float x, float y)
@@ -556,12 +472,12 @@ static void VirtualGamepadMouseMotion(float x, float y)
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((y - virtual_axis_start_y) / AXIS_SIZE, 0.0f, 1.0f);
float distance = SDL_clamp((y - virtual_axis_start_y) / GetGamepadImageAxisHeight(image), 0.0f, 1.0f);
Sint16 value = (Sint16)(SDL_JOYSTICK_AXIS_MIN + (distance * range));
SDL_SetJoystickVirtualAxis(virtual_joystick, virtual_axis_active, value);
} else {
float distanceX = SDL_clamp((x - virtual_axis_start_x) / AXIS_SIZE, -1.0f, 1.0f);
float distanceY = SDL_clamp((y - virtual_axis_start_y) / AXIS_SIZE, -1.0f, 1.0f);
float distanceX = SDL_clamp((x - virtual_axis_start_x) / GetGamepadImageAxisWidth(image), -1.0f, 1.0f);
float distanceY = SDL_clamp((y - virtual_axis_start_y) / GetGamepadImageAxisHeight(image), -1.0f, 1.0f);
Sint16 valueX, valueY;
if (distanceX >= 0) {
@@ -621,8 +537,6 @@ static void VirtualGamepadMouseUp(float x, float y)
static void loop(void *arg)
{
SDL_Event event;
int i;
SDL_bool showing_front;
/* Update to get the current event state */
SDL_PumpEvents();
@@ -754,52 +668,14 @@ static void loop(void *arg)
}
}
showing_front = ShowingFront();
/* blank screen, set up for drawing this frame. */
SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE);
SDL_RenderClear(screen);
SDL_RenderTexture(screen, showing_front ? background_front : background_back, NULL, NULL);
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_FRect dst;
dst.x = (float)button_positions[i].x;
dst.y = (float)button_positions[i].y;
dst.w = (float)BUTTON_SIZE;
dst.h = (float)BUTTON_SIZE;
SDL_RenderTextureRotated(screen, button_texture, NULL, &dst, 0, NULL, SDL_FLIP_NONE);
}
}
}
if (showing_front) {
for (i = 0; i < SDL_GAMEPAD_AXIS_MAX; ++i) {
const Sint16 deadzone = 8000; /* !!! FIXME: real deadzone */
const Sint16 value = SDL_GetGamepadAxis(gamepad, (SDL_GamepadAxis)(i));
if (value < -deadzone) {
const double angle = axis_positions[i].angle;
SDL_FRect dst;
dst.x = (float)axis_positions[i].x;
dst.y = (float)axis_positions[i].y;
dst.w = (float)AXIS_SIZE;
dst.h = (float)AXIS_SIZE;
SDL_RenderTextureRotated(screen, axis_texture, NULL, &dst, angle, NULL, SDL_FLIP_NONE);
} else if (value > deadzone) {
const double angle = axis_positions[i].angle + 180.0;
SDL_FRect dst;
dst.x = (float)axis_positions[i].x;
dst.y = (float)axis_positions[i].y;
dst.w = (float)AXIS_SIZE;
dst.h = (float)AXIS_SIZE;
SDL_RenderTextureRotated(screen, axis_texture, NULL, &dst, angle, NULL, SDL_FLIP_NONE);
}
}
}
SetGamepadImageShowingFront(image, ShowingFront());
UpdateGamepadImageFromGamepad(image, gamepad);
RenderGamepadImage(image);
/* Update LED based on left thumbstick position */
{
@@ -955,18 +831,12 @@ int main(int argc, char *argv[])
SDL_LOGICAL_PRESENTATION_LETTERBOX,
SDL_SCALEMODE_LINEAR);
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);
if (background_front == NULL || background_back == NULL || button_texture == NULL || axis_texture == NULL) {
image = CreateGamepadImage(screen);
if (image == NULL) {
SDL_DestroyRenderer(screen);
SDL_DestroyWindow(window);
return 2;
}
SDL_SetTextureColorMod(button_texture, 10, 255, 21);
SDL_SetTextureColorMod(axis_texture, 10, 255, 21);
/* Process the initial gamepad list */
loop(NULL);
@@ -994,6 +864,7 @@ int main(int argc, char *argv[])
}
CloseVirtualGamepad();
DestroyGamepadImage(image);
SDL_DestroyRenderer(screen);
SDL_DestroyWindow(window);
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD);