├── .gitignore ├── .gitmodules ├── SDL2 ├── SDL2.vcxproj ├── SDL2.vcxproj.filters └── src │ ├── cpufeatures │ ├── Android.mk │ ├── NOTICE │ ├── cpu-features.c │ ├── cpu-features.h │ └── repo.prop │ └── hidapi │ └── android │ ├── hidapi.vcxproj │ └── hidapi.vcxproj.filters ├── SDL2_GradleApp ├── SDL2_GradleApp.androidproj ├── app │ ├── build.gradle │ ├── build.gradle.template │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── AndroidManifest.xml.template │ │ ├── assets │ │ └── fonts │ │ │ ├── LICENSE.txt │ │ │ └── OpenSans-Regular.ttf │ │ ├── java │ │ ├── com │ │ │ └── SDL2_GradleApp │ │ │ │ └── SDL2_GradleApp.java │ │ └── org │ │ │ └── libsdl │ │ │ └── app │ │ │ ├── HIDDevice.java │ │ │ ├── HIDDeviceBLESteamController.java │ │ │ ├── HIDDeviceManager.java │ │ │ ├── HIDDeviceUSB.java │ │ │ ├── SDL.java │ │ │ ├── SDLActivity.java │ │ │ ├── SDLAudioManager.java │ │ │ └── SDLControllerManager.java │ │ └── res │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── build.gradle.template ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ ├── gradle-wrapper.properties │ │ └── gradle-wrapper.properties.template ├── gradlew.bat ├── settings.gradle └── settings.gradle.template ├── SDL2_image ├── SDL2_image.vcxproj └── SDL2_image.vcxproj.filters ├── SDL2_project.sln ├── SDL2_ttf ├── SDL2_ttf.vcxproj └── SDL2_ttf.vcxproj.filters ├── main ├── main.cpp ├── main.vcxproj └── main.vcxproj.filters └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | ARM 2 | ARM64 3 | /.vs 4 | /SDL2_GradleApp/app/build 5 | /SDL2_GradleApp/.gradle 6 | x86 7 | /SDL2_GradleApp/app/src/main/jniLibs 8 | *.user 9 | /.workspace 10 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libsdl/SDL"] 2 | path = libsdl/SDL 3 | url = https://github.com/libsdl-org/SDL 4 | branch = main 5 | [submodule "libsdl/SDL_ttf"] 6 | path = libsdl/SDL_ttf 7 | url = https://github.com/libsdl-org/SDL_ttf 8 | branch = main 9 | [submodule "libsdl/SDL_image"] 10 | path = libsdl/SDL_image 11 | url = https://github.com/libsdl-org/SDL_image 12 | branch = main 13 | -------------------------------------------------------------------------------- /SDL2/src/cpufeatures/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := cpufeatures 5 | LOCAL_SRC_FILES := cpu-features.c 6 | LOCAL_CFLAGS := -Wall -Wextra -Werror 7 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) 8 | LOCAL_EXPORT_LDLIBS := -ldl 9 | include $(BUILD_STATIC_LIBRARY) 10 | -------------------------------------------------------------------------------- /SDL2/src/cpufeatures/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 The Android Open Source Project 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /SDL2/src/cpufeatures/cpu-features.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in 12 | * the documentation and/or other materials provided with the 13 | * distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | * SUCH DAMAGE. 27 | */ 28 | #ifndef CPU_FEATURES_H 29 | #define CPU_FEATURES_H 30 | 31 | #include 32 | #include 33 | 34 | __BEGIN_DECLS 35 | 36 | /* A list of valid values returned by android_getCpuFamily(). 37 | * They describe the CPU Architecture of the current process. 38 | */ 39 | typedef enum { 40 | ANDROID_CPU_FAMILY_UNKNOWN = 0, 41 | ANDROID_CPU_FAMILY_ARM, 42 | ANDROID_CPU_FAMILY_X86, 43 | ANDROID_CPU_FAMILY_MIPS, 44 | ANDROID_CPU_FAMILY_ARM64, 45 | ANDROID_CPU_FAMILY_X86_64, 46 | ANDROID_CPU_FAMILY_MIPS64, 47 | 48 | ANDROID_CPU_FAMILY_MAX /* do not remove */ 49 | 50 | } AndroidCpuFamily; 51 | 52 | /* Return the CPU family of the current process. 53 | * 54 | * Note that this matches the bitness of the current process. I.e. when 55 | * running a 32-bit binary on a 64-bit capable CPU, this will return the 56 | * 32-bit CPU family value. 57 | */ 58 | extern AndroidCpuFamily android_getCpuFamily(void); 59 | 60 | /* Return a bitmap describing a set of optional CPU features that are 61 | * supported by the current device's CPU. The exact bit-flags returned 62 | * depend on the value returned by android_getCpuFamily(). See the 63 | * documentation for the ANDROID_CPU_*_FEATURE_* flags below for details. 64 | */ 65 | extern uint64_t android_getCpuFeatures(void); 66 | 67 | /* The list of feature flags for ANDROID_CPU_FAMILY_ARM that can be 68 | * recognized by the library (see note below for 64-bit ARM). Value details 69 | * are: 70 | * 71 | * VFPv2: 72 | * CPU supports the VFPv2 instruction set. Many, but not all, ARMv6 CPUs 73 | * support these instructions. VFPv2 is a subset of VFPv3 so this will 74 | * be set whenever VFPv3 is set too. 75 | * 76 | * ARMv7: 77 | * CPU supports the ARMv7-A basic instruction set. 78 | * This feature is mandated by the 'armeabi-v7a' ABI. 79 | * 80 | * VFPv3: 81 | * CPU supports the VFPv3-D16 instruction set, providing hardware FPU 82 | * support for single and double precision floating point registers. 83 | * Note that only 16 FPU registers are available by default, unless 84 | * the D32 bit is set too. This feature is also mandated by the 85 | * 'armeabi-v7a' ABI. 86 | * 87 | * VFP_D32: 88 | * CPU VFP optional extension that provides 32 FPU registers, 89 | * instead of 16. Note that ARM mandates this feature is the 'NEON' 90 | * feature is implemented by the CPU. 91 | * 92 | * NEON: 93 | * CPU FPU supports "ARM Advanced SIMD" instructions, also known as 94 | * NEON. Note that this mandates the VFP_D32 feature as well, per the 95 | * ARM Architecture specification. 96 | * 97 | * VFP_FP16: 98 | * Half-width floating precision VFP extension. If set, the CPU 99 | * supports instructions to perform floating-point operations on 100 | * 16-bit registers. This is part of the VFPv4 specification, but 101 | * not mandated by any Android ABI. 102 | * 103 | * VFP_FMA: 104 | * Fused multiply-accumulate VFP instructions extension. Also part of 105 | * the VFPv4 specification, but not mandated by any Android ABI. 106 | * 107 | * NEON_FMA: 108 | * Fused multiply-accumulate NEON instructions extension. Optional 109 | * extension from the VFPv4 specification, but not mandated by any 110 | * Android ABI. 111 | * 112 | * IDIV_ARM: 113 | * Integer division available in ARM mode. Only available 114 | * on recent CPUs (e.g. Cortex-A15). 115 | * 116 | * IDIV_THUMB2: 117 | * Integer division available in Thumb-2 mode. Only available 118 | * on recent CPUs (e.g. Cortex-A15). 119 | * 120 | * iWMMXt: 121 | * Optional extension that adds MMX registers and operations to an 122 | * ARM CPU. This is only available on a few XScale-based CPU designs 123 | * sold by Marvell. Pretty rare in practice. 124 | * 125 | * AES: 126 | * CPU supports AES instructions. These instructions are only 127 | * available for 32-bit applications running on ARMv8 CPU. 128 | * 129 | * CRC32: 130 | * CPU supports CRC32 instructions. These instructions are only 131 | * available for 32-bit applications running on ARMv8 CPU. 132 | * 133 | * SHA2: 134 | * CPU supports SHA2 instructions. These instructions are only 135 | * available for 32-bit applications running on ARMv8 CPU. 136 | * 137 | * SHA1: 138 | * CPU supports SHA1 instructions. These instructions are only 139 | * available for 32-bit applications running on ARMv8 CPU. 140 | * 141 | * PMULL: 142 | * CPU supports 64-bit PMULL and PMULL2 instructions. These 143 | * instructions are only available for 32-bit applications 144 | * running on ARMv8 CPU. 145 | * 146 | * If you want to tell the compiler to generate code that targets one of 147 | * the feature set above, you should probably use one of the following 148 | * flags (for more details, see technical note at the end of this file): 149 | * 150 | * -mfpu=vfp 151 | * -mfpu=vfpv2 152 | * These are equivalent and tell GCC to use VFPv2 instructions for 153 | * floating-point operations. Use this if you want your code to 154 | * run on *some* ARMv6 devices, and any ARMv7-A device supported 155 | * by Android. 156 | * 157 | * Generated code requires VFPv2 feature. 158 | * 159 | * -mfpu=vfpv3-d16 160 | * Tell GCC to use VFPv3 instructions (using only 16 FPU registers). 161 | * This should be generic code that runs on any CPU that supports the 162 | * 'armeabi-v7a' Android ABI. Note that no ARMv6 CPU supports this. 163 | * 164 | * Generated code requires VFPv3 feature. 165 | * 166 | * -mfpu=vfpv3 167 | * Tell GCC to use VFPv3 instructions with 32 FPU registers. 168 | * Generated code requires VFPv3|VFP_D32 features. 169 | * 170 | * -mfpu=neon 171 | * Tell GCC to use VFPv3 instructions with 32 FPU registers, and 172 | * also support NEON intrinsics (see ). 173 | * Generated code requires VFPv3|VFP_D32|NEON features. 174 | * 175 | * -mfpu=vfpv4-d16 176 | * Generated code requires VFPv3|VFP_FP16|VFP_FMA features. 177 | * 178 | * -mfpu=vfpv4 179 | * Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32 features. 180 | * 181 | * -mfpu=neon-vfpv4 182 | * Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32|NEON|NEON_FMA 183 | * features. 184 | * 185 | * -mcpu=cortex-a7 186 | * -mcpu=cortex-a15 187 | * Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32| 188 | * NEON|NEON_FMA|IDIV_ARM|IDIV_THUMB2 189 | * This flag implies -mfpu=neon-vfpv4. 190 | * 191 | * -mcpu=iwmmxt 192 | * Allows the use of iWMMXt instrinsics with GCC. 193 | * 194 | * IMPORTANT NOTE: These flags should only be tested when 195 | * android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM, i.e. this is a 196 | * 32-bit process. 197 | * 198 | * When running a 64-bit ARM process on an ARMv8 CPU, 199 | * android_getCpuFeatures() will return a different set of bitflags 200 | */ 201 | enum { 202 | ANDROID_CPU_ARM_FEATURE_ARMv7 = (1 << 0), 203 | ANDROID_CPU_ARM_FEATURE_VFPv3 = (1 << 1), 204 | ANDROID_CPU_ARM_FEATURE_NEON = (1 << 2), 205 | ANDROID_CPU_ARM_FEATURE_LDREX_STREX = (1 << 3), 206 | ANDROID_CPU_ARM_FEATURE_VFPv2 = (1 << 4), 207 | ANDROID_CPU_ARM_FEATURE_VFP_D32 = (1 << 5), 208 | ANDROID_CPU_ARM_FEATURE_VFP_FP16 = (1 << 6), 209 | ANDROID_CPU_ARM_FEATURE_VFP_FMA = (1 << 7), 210 | ANDROID_CPU_ARM_FEATURE_NEON_FMA = (1 << 8), 211 | ANDROID_CPU_ARM_FEATURE_IDIV_ARM = (1 << 9), 212 | ANDROID_CPU_ARM_FEATURE_IDIV_THUMB2 = (1 << 10), 213 | ANDROID_CPU_ARM_FEATURE_iWMMXt = (1 << 11), 214 | ANDROID_CPU_ARM_FEATURE_AES = (1 << 12), 215 | ANDROID_CPU_ARM_FEATURE_PMULL = (1 << 13), 216 | ANDROID_CPU_ARM_FEATURE_SHA1 = (1 << 14), 217 | ANDROID_CPU_ARM_FEATURE_SHA2 = (1 << 15), 218 | ANDROID_CPU_ARM_FEATURE_CRC32 = (1 << 16), 219 | }; 220 | 221 | /* The bit flags corresponding to the output of android_getCpuFeatures() 222 | * when android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM64. Value details 223 | * are: 224 | * 225 | * FP: 226 | * CPU has Floating-point unit. 227 | * 228 | * ASIMD: 229 | * CPU has Advanced SIMD unit. 230 | * 231 | * AES: 232 | * CPU supports AES instructions. 233 | * 234 | * CRC32: 235 | * CPU supports CRC32 instructions. 236 | * 237 | * SHA2: 238 | * CPU supports SHA2 instructions. 239 | * 240 | * SHA1: 241 | * CPU supports SHA1 instructions. 242 | * 243 | * PMULL: 244 | * CPU supports 64-bit PMULL and PMULL2 instructions. 245 | */ 246 | enum { 247 | ANDROID_CPU_ARM64_FEATURE_FP = (1 << 0), 248 | ANDROID_CPU_ARM64_FEATURE_ASIMD = (1 << 1), 249 | ANDROID_CPU_ARM64_FEATURE_AES = (1 << 2), 250 | ANDROID_CPU_ARM64_FEATURE_PMULL = (1 << 3), 251 | ANDROID_CPU_ARM64_FEATURE_SHA1 = (1 << 4), 252 | ANDROID_CPU_ARM64_FEATURE_SHA2 = (1 << 5), 253 | ANDROID_CPU_ARM64_FEATURE_CRC32 = (1 << 6), 254 | }; 255 | 256 | /* The bit flags corresponding to the output of android_getCpuFeatures() 257 | * when android_getCpuFamily() returns ANDROID_CPU_FAMILY_X86 or 258 | * ANDROID_CPU_FAMILY_X86_64. 259 | */ 260 | enum { 261 | ANDROID_CPU_X86_FEATURE_SSSE3 = (1 << 0), 262 | ANDROID_CPU_X86_FEATURE_POPCNT = (1 << 1), 263 | ANDROID_CPU_X86_FEATURE_MOVBE = (1 << 2), 264 | ANDROID_CPU_X86_FEATURE_SSE4_1 = (1 << 3), 265 | ANDROID_CPU_X86_FEATURE_SSE4_2 = (1 << 4), 266 | ANDROID_CPU_X86_FEATURE_AES_NI = (1 << 5), 267 | ANDROID_CPU_X86_FEATURE_AVX = (1 << 6), 268 | ANDROID_CPU_X86_FEATURE_RDRAND = (1 << 7), 269 | ANDROID_CPU_X86_FEATURE_AVX2 = (1 << 8), 270 | ANDROID_CPU_X86_FEATURE_SHA_NI = (1 << 9), 271 | }; 272 | 273 | /* The bit flags corresponding to the output of android_getCpuFeatures() 274 | * when android_getCpuFamily() returns ANDROID_CPU_FAMILY_MIPS 275 | * or ANDROID_CPU_FAMILY_MIPS64. Values are: 276 | * 277 | * R6: 278 | * CPU executes MIPS Release 6 instructions natively, and 279 | * supports obsoleted R1..R5 instructions only via kernel traps. 280 | * 281 | * MSA: 282 | * CPU supports Mips SIMD Architecture instructions. 283 | */ 284 | enum { 285 | ANDROID_CPU_MIPS_FEATURE_R6 = (1 << 0), 286 | ANDROID_CPU_MIPS_FEATURE_MSA = (1 << 1), 287 | }; 288 | 289 | 290 | /* Return the number of CPU cores detected on this device. */ 291 | extern int android_getCpuCount(void); 292 | 293 | /* The following is used to force the CPU count and features 294 | * mask in sandboxed processes. Under 4.1 and higher, these processes 295 | * cannot access /proc, which is the only way to get information from 296 | * the kernel about the current hardware (at least on ARM). 297 | * 298 | * It _must_ be called only once, and before any android_getCpuXXX 299 | * function, any other case will fail. 300 | * 301 | * This function return 1 on success, and 0 on failure. 302 | */ 303 | extern int android_setCpu(int cpu_count, 304 | uint64_t cpu_features); 305 | 306 | #ifdef __arm__ 307 | /* Retrieve the ARM 32-bit CPUID value from the kernel. 308 | * Note that this cannot work on sandboxed processes under 4.1 and 309 | * higher, unless you called android_setCpuArm() before. 310 | */ 311 | extern uint32_t android_getCpuIdArm(void); 312 | 313 | /* An ARM-specific variant of android_setCpu() that also allows you 314 | * to set the ARM CPUID field. 315 | */ 316 | extern int android_setCpuArm(int cpu_count, 317 | uint64_t cpu_features, 318 | uint32_t cpu_id); 319 | #endif 320 | 321 | __END_DECLS 322 | 323 | #endif /* CPU_FEATURES_H */ 324 | -------------------------------------------------------------------------------- /SDL2/src/cpufeatures/repo.prop: -------------------------------------------------------------------------------- 1 | platform/bionic 0237218b90c81a6977be59971d52f20063c0793c 2 | platform/development b7732bd3281041709d40c6e07cd8e66c682cb943 3 | platform/external/googletest 220810a546aa9db3a3cfd39874663884dbbe8c59 4 | platform/external/libcxx 44244c14a5a0727733137dcbea47474cec8debe8 5 | platform/external/libcxxabi fa5a0a5055c2da528f4acd8f4ac5a62b2da7d133 6 | platform/external/libunwind_llvm fecc6f26cfdbfc9cf0ea2021629ac6e85b7c0113 7 | platform/external/llvm 79c7f5d7a2be0de081031e0ebcd481ab7905854b 8 | platform/external/shaderc/glslang 4fba78ac61073ee065872ad177dc93a8afca559f 9 | platform/external/shaderc/shaderc 79a76bebdbc35da49ee0e89a31357995f57abb38 10 | platform/external/shaderc/spirv-headers 9b020b2c0b467a4a9c5c00b9771bca956223bc49 11 | platform/external/shaderc/spirv-tools 269c7e8719231e41365a96b6bfd659899b6f7703 12 | platform/external/vulkan-validation-layers f6b5827624fb49308eb1576287fd35d3fe5a1863 13 | platform/manifest 84e2d198c54099754062710cbfca859831cea689 14 | platform/ndk ceca5f4bf98175cac7c1fe016fcb7fd7040e551d 15 | platform/prebuilts/clang/host/darwin-x86 8ff3ad1ad95e9c4f20bf3734a26b002fb4100029 16 | platform/prebuilts/clang/host/linux-x86 585b7364a96a55546256e158a78a9ffb7a02c889 17 | platform/prebuilts/clang/host/windows-x86 c56e837ed056a5a2b49244f953cc4fe92b5f9847 18 | platform/prebuilts/clang/host/windows-x86_32 63ba9571a8f83ed2318bfb9b894009dd709b23df 19 | platform/prebuilts/cmake/darwin-x86 f3bfe547014d2d751b7547ad7847a51b0ea34dc8 20 | platform/prebuilts/cmake/linux-x86 da4b9cb08341185e002c8a8c5df73533cdb93b41 21 | platform/prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9 52b2154bec58eccfab8218871571bfd88165b60f 22 | platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8 6d08ca9f45ff685648fd13c75bf5cac4b11c19bb 23 | platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.9 f6f8888de381d21f6cfbd91319e584777db60f8d 24 | platform/prebuilts/gcc/darwin-x86/host/headers 4ac4f7cc41cf3c9e36fc3d6cf37fd1cfa9587a68 25 | platform/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1 ec5aa66aaa4964c27564d0ec84dc1f18a2d72b7e 26 | platform/prebuilts/gcc/darwin-x86/mips/mips64el-linux-android-4.9 d942564c9331f07026a8f78502d8571206eb7be4 27 | platform/prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.9 a2aa0df7a6748bfc13d7e90c9fe41fb915164d30 28 | platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 3b7cd710b8c4e3dddd22979ff6148514b996293a 29 | platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8 26e93f6af47f7bd3a9beb5c102a5f45e19bfa38a 30 | platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9 c586b970aed16e970f23e0fb4197920f6b221c7f 31 | platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8 bf0dafede3fafd5bf28c631489cd15fd222c139d 32 | platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8 2ccb38af8c940f1feef62ff5986f4bbc5d899e66 33 | platform/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8 e76a9a506d7ad132f107eb2f7c27b6a8ccb68b91 34 | platform/prebuilts/gcc/linux-x86/mips/mips64el-linux-android-4.9 388fdc4995d374d76a0c4b292afabac91638e134 35 | platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9 a448493cc447864f1838d4d220eadd901e36787a 36 | platform/prebuilts/ndk 49605f7c20232ba9189172d2717953bc8f62d595 37 | platform/prebuilts/ninja/darwin-x86 00f798346dedb4a7a6a6dcc9ad32ff09d66ee0db 38 | platform/prebuilts/ninja/linux-x86 6369b19fc3fbe765636af75d394627e2b92599ed 39 | platform/prebuilts/python/darwin-x86/2.7.5 0c5958b1636c47ed7c284f859c8e805fd06a0e63 40 | platform/prebuilts/python/linux-x86/2.7.5 47abe498f32ff1721f5177ad5a51ee0e35d969ed 41 | platform/prebuilts/renderscript/host/darwin-x86 a0ede5664b4741348c0b6c8d5da06d483dcf2876 42 | platform/prebuilts/renderscript/host/linux-x86 68a0a1ddacb81c97d718f46ad464a3851d0b67af 43 | platform/prebuilts/renderscript/host/windows-x86 5df9f20565e63906167c82f6120c78e969b3b467 44 | platform/prebuilts/simpleperf a8fbea9844ddb5a7d55b2e3e417695ebfcd5475f 45 | toolchain/binutils 6fa214b61c53685d846a18d1001aa437c8338821 46 | toolchain/build 58be6006bb71abb97d7cdff7be3e73d55bbc22b8 47 | toolchain/cloog 604793eab97d360aef729f064674569ee6dbf3e1 48 | toolchain/expat 40172a0ae9d40a068f1e1a48ffcf6a1ccf765ed5 49 | toolchain/gcc 430f43829fa42b459ccbb53b44843c54c8ba4550 50 | toolchain/gdb 3b4e21d2318bc1b6547e45f3393514e7b0be7df2 51 | toolchain/gmp b2acd5dbf47868ac5b5bc844e16d2cadcbd4c810 52 | toolchain/isl 0ccf95726af8ce58ad61ff474addbce3a31ba99c 53 | toolchain/mpc 835d16e92eed875638a8b5d552034c3b1aae045b 54 | toolchain/mpfr de979fc377db766591e7feaf052f0de59be46e76 55 | toolchain/ppl 979062d362bc5a1c00804237b408b19b4618fb24 56 | toolchain/python 2f9d862430f8b1d838f0ba1adac0bdc2b7142a3e 57 | toolchain/sed 45df23d6dc8b51ea5cd903d023c10fd7d72415b9 58 | toolchain/xz a0eb1f5763e7b4a3daf4fd7d1ac9504058cc1082 59 | toolchain/yasm 89fed6578607187830790c96d7310cf5fc635ffd 60 | -------------------------------------------------------------------------------- /SDL2/src/hidapi/android/hidapi.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | ARM 7 | 8 | 9 | Release 10 | ARM 11 | 12 | 13 | Debug 14 | ARM64 15 | 16 | 17 | Release 18 | ARM64 19 | 20 | 21 | Debug 22 | x64 23 | 24 | 25 | Release 26 | x64 27 | 28 | 29 | Debug 30 | x86 31 | 32 | 33 | Release 34 | x86 35 | 36 | 37 | 38 | 39 | 40 | 41 | {654d6f15-267a-423d-8606-351c153c4e3d} 42 | Android 43 | hidapi 44 | 14.0 45 | Android 46 | 3.0 47 | 48 | 49 | 50 | DynamicLibrary 51 | true 52 | Clang_5_0 53 | android-26 54 | 55 | 56 | DynamicLibrary 57 | false 58 | Clang_5_0 59 | android-26 60 | 61 | 62 | DynamicLibrary 63 | true 64 | Clang_5_0 65 | android-26 66 | 67 | 68 | DynamicLibrary 69 | false 70 | Clang_5_0 71 | android-26 72 | 73 | 74 | DynamicLibrary 75 | true 76 | Clang_5_0 77 | android-26 78 | 79 | 80 | DynamicLibrary 81 | false 82 | Clang_5_0 83 | android-26 84 | 85 | 86 | DynamicLibrary 87 | true 88 | Clang_5_0 89 | android-26 90 | 91 | 92 | DynamicLibrary 93 | false 94 | Clang_5_0 95 | android-26 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | NotUsing 121 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\SDL2\include 122 | c++1z 123 | 124 | 125 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 126 | 127 | 128 | 129 | 130 | NotUsing 131 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\SDL2\include 132 | c++1z 133 | 134 | 135 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 136 | 137 | 138 | 139 | 140 | NotUsing 141 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\SDL2\include 142 | c++1z 143 | 144 | 145 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 146 | 147 | 148 | 149 | 150 | NotUsing 151 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\SDL2\include 152 | c++1z 153 | 154 | 155 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 156 | 157 | 158 | 159 | 160 | NotUsing 161 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\SDL2\include 162 | c++1z 163 | 164 | 165 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 166 | 167 | 168 | 169 | 170 | NotUsing 171 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\SDL2\include 172 | c++1z 173 | 174 | 175 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 176 | 177 | 178 | 179 | 180 | NotUsing 181 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\SDL2\include 182 | c++1z 183 | 184 | 185 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 186 | 187 | 188 | 189 | 190 | NotUsing 191 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\SDL2\include 192 | c++1z 193 | 194 | 195 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /SDL2/src/hidapi/android/hidapi.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SDL2_GradleApp/SDL2_GradleApp.androidproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | ARM 7 | 8 | 9 | Release 10 | ARM 11 | 12 | 13 | Debug 14 | ARM64 15 | 16 | 17 | Release 18 | ARM64 19 | 20 | 21 | Debug 22 | x86 23 | 24 | 25 | Release 26 | x86 27 | 28 | 29 | Debug 30 | x64 31 | 32 | 33 | Release 34 | x64 35 | 36 | 37 | 38 | Gradle 39 | SDL2_GradleApp 40 | 14.0 41 | 1.0 42 | {f38408b0-8d17-4d2b-aeb4-5fa30b7f6373} 43 | <_PackagingProjectWithoutNativeComponent>true 44 | com.SDL2_GradleApp.SDL2_GradleApp 45 | src\main\java 46 | 47 | 48 | 49 | Application 50 | android-26 51 | 52 | 53 | Application 54 | android-26 55 | 56 | 57 | Application 58 | android-26 59 | 60 | 61 | Application 62 | android-26 63 | 64 | 65 | Application 66 | android-26 67 | 68 | 69 | Application 70 | android-26 71 | 72 | 73 | Application 74 | android-26 75 | 76 | 77 | Application 78 | android-26 79 | 80 | 81 | 82 | 83 | $(ProjectDir)app 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.model.application' 2 | 3 | model { 4 | android { 5 | compileSdkVersion = 26 6 | buildToolsVersion = "30.0.3" 7 | 8 | defaultConfig.with { 9 | applicationId = "com.SDL2_GradleApp" 10 | minSdkVersion.apiLevel = 16 11 | targetSdkVersion.apiLevel = 23 12 | } 13 | 14 | compileOptions.with { 15 | sourceCompatibility=JavaVersion.VERSION_1_7 16 | targetCompatibility=JavaVersion.VERSION_1_7 17 | } 18 | } 19 | 20 | android.buildTypes { 21 | release { 22 | minifyEnabled = false 23 | proguardFiles.add(file('proguard-rules.txt')) 24 | ndk.debuggable = true 25 | debuggable = true 26 | } 27 | } 28 | 29 | android.productFlavors { 30 | create("arm7") { 31 | ndk.abiFilters.add("armeabi-v7a") 32 | } 33 | create("arm8") { 34 | ndk.abiFilters.add("arm64-v8a") 35 | } 36 | create("x86") { 37 | ndk.abiFilters.add("x86") 38 | } 39 | create("x86-64") { 40 | ndk.abiFilters.add("x86_64") 41 | } 42 | create("all") 43 | } 44 | } 45 | 46 | repositories { 47 | flatDir { 48 | dirs 'libs' 49 | } 50 | } 51 | 52 | dependencies { 53 | compile fileTree(dir: 'libs', include: ['*.jar']) 54 | 55 | } -------------------------------------------------------------------------------- /SDL2_GradleApp/app/build.gradle.template: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.model.$(ConfigurationType)' 2 | 3 | model { 4 | android { 5 | compileSdkVersion = $(AndroidAPILevelNumber) 6 | buildToolsVersion = "$(AndroidBuildToolsVersion)" 7 | 8 | defaultConfig.with { 9 | $(ApplicationId) 10 | minSdkVersion.apiLevel = 16 11 | targetSdkVersion.apiLevel = 23 12 | } 13 | 14 | compileOptions.with { 15 | sourceCompatibility=JavaVersion.VERSION_1_7 16 | targetCompatibility=JavaVersion.VERSION_1_7 17 | } 18 | } 19 | 20 | android.buildTypes { 21 | release { 22 | minifyEnabled = false 23 | proguardFiles.add(file('proguard-rules.txt')) 24 | ndk.debuggable = true 25 | debuggable = true 26 | } 27 | } 28 | 29 | android.productFlavors { 30 | create("arm7") { 31 | ndk.abiFilters.add("armeabi-v7a") 32 | } 33 | create("arm8") { 34 | ndk.abiFilters.add("arm64-v8a") 35 | } 36 | create("x86") { 37 | ndk.abiFilters.add("x86") 38 | } 39 | create("x86-64") { 40 | ndk.abiFilters.add("x86_64") 41 | } 42 | create("all") 43 | } 44 | } 45 | 46 | repositories { 47 | flatDir { 48 | dirs 'libs' 49 | } 50 | } 51 | 52 | dependencies { 53 | compile fileTree(dir: 'libs', include: ['*.jar']) 54 | $(AarDependencies) 55 | } -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 45 | 50 | 51 | 54 | 55 | 61 | 62 | 63 | 64 | 65 | 66 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/AndroidManifest.xml.template: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 45 | 50 | 51 | 54 | 55 | 61 | 62 | 63 | 64 | 65 | 66 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/assets/fonts/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/assets/fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallahn/sdl2vs/4b9a1540893cddda62d895ff865e8646048c6173/SDL2_GradleApp/app/src/main/assets/fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/java/com/SDL2_GradleApp/SDL2_GradleApp.java: -------------------------------------------------------------------------------- 1 | 2 | package com.SDL2_GradleApp; 3 | 4 | import android.os.Bundle; 5 | import org.libsdl.app.SDLActivity; 6 | 7 | public class SDL2_GradleApp extends SDLActivity 8 | { 9 | /** Called when the activity is first created. */ 10 | @Override 11 | public void onCreate(Bundle savedInstanceState) 12 | { 13 | super.onCreate(savedInstanceState); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/java/org/libsdl/app/HIDDevice.java: -------------------------------------------------------------------------------- 1 | package org.libsdl.app; 2 | 3 | import android.hardware.usb.UsbDevice; 4 | 5 | interface HIDDevice 6 | { 7 | public int getId(); 8 | public int getVendorId(); 9 | public int getProductId(); 10 | public String getSerialNumber(); 11 | public int getVersion(); 12 | public String getManufacturerName(); 13 | public String getProductName(); 14 | public UsbDevice getDevice(); 15 | public boolean open(); 16 | public int sendFeatureReport(byte[] report); 17 | public int sendOutputReport(byte[] report); 18 | public boolean getFeatureReport(byte[] report); 19 | public void setFrozen(boolean frozen); 20 | public void close(); 21 | public void shutdown(); 22 | } 23 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java: -------------------------------------------------------------------------------- 1 | package org.libsdl.app; 2 | 3 | import android.content.Context; 4 | import android.bluetooth.BluetoothDevice; 5 | import android.bluetooth.BluetoothGatt; 6 | import android.bluetooth.BluetoothGattCallback; 7 | import android.bluetooth.BluetoothGattCharacteristic; 8 | import android.bluetooth.BluetoothGattDescriptor; 9 | import android.bluetooth.BluetoothManager; 10 | import android.bluetooth.BluetoothProfile; 11 | import android.bluetooth.BluetoothGattService; 12 | import android.hardware.usb.UsbDevice; 13 | import android.os.Handler; 14 | import android.os.Looper; 15 | import android.util.Log; 16 | import android.os.*; 17 | 18 | //import com.android.internal.util.HexDump; 19 | 20 | import java.lang.Runnable; 21 | import java.util.Arrays; 22 | import java.util.LinkedList; 23 | import java.util.UUID; 24 | 25 | class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDevice { 26 | 27 | private static final String TAG = "hidapi"; 28 | private HIDDeviceManager mManager; 29 | private BluetoothDevice mDevice; 30 | private int mDeviceId; 31 | private BluetoothGatt mGatt; 32 | private boolean mIsRegistered = false; 33 | private boolean mIsConnected = false; 34 | private boolean mIsChromebook = false; 35 | private boolean mIsReconnecting = false; 36 | private boolean mFrozen = false; 37 | private LinkedList mOperations; 38 | GattOperation mCurrentOperation = null; 39 | private Handler mHandler; 40 | 41 | private static final int TRANSPORT_AUTO = 0; 42 | private static final int TRANSPORT_BREDR = 1; 43 | private static final int TRANSPORT_LE = 2; 44 | 45 | private static final int CHROMEBOOK_CONNECTION_CHECK_INTERVAL = 10000; 46 | 47 | static public final UUID steamControllerService = UUID.fromString("100F6C32-1735-4313-B402-38567131E5F3"); 48 | static public final UUID inputCharacteristic = UUID.fromString("100F6C33-1735-4313-B402-38567131E5F3"); 49 | static public final UUID reportCharacteristic = UUID.fromString("100F6C34-1735-4313-B402-38567131E5F3"); 50 | static private final byte[] enterValveMode = new byte[] { (byte)0xC0, (byte)0x87, 0x03, 0x08, 0x07, 0x00 }; 51 | 52 | static class GattOperation { 53 | private enum Operation { 54 | CHR_READ, 55 | CHR_WRITE, 56 | ENABLE_NOTIFICATION 57 | } 58 | 59 | Operation mOp; 60 | UUID mUuid; 61 | byte[] mValue; 62 | BluetoothGatt mGatt; 63 | boolean mResult = true; 64 | 65 | private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid) { 66 | mGatt = gatt; 67 | mOp = operation; 68 | mUuid = uuid; 69 | } 70 | 71 | private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid, byte[] value) { 72 | mGatt = gatt; 73 | mOp = operation; 74 | mUuid = uuid; 75 | mValue = value; 76 | } 77 | 78 | public void run() { 79 | // This is executed in main thread 80 | BluetoothGattCharacteristic chr; 81 | 82 | switch (mOp) { 83 | case CHR_READ: 84 | chr = getCharacteristic(mUuid); 85 | //Log.v(TAG, "Reading characteristic " + chr.getUuid()); 86 | if (!mGatt.readCharacteristic(chr)) { 87 | Log.e(TAG, "Unable to read characteristic " + mUuid.toString()); 88 | mResult = false; 89 | break; 90 | } 91 | mResult = true; 92 | break; 93 | case CHR_WRITE: 94 | chr = getCharacteristic(mUuid); 95 | //Log.v(TAG, "Writing characteristic " + chr.getUuid() + " value=" + HexDump.toHexString(value)); 96 | chr.setValue(mValue); 97 | if (!mGatt.writeCharacteristic(chr)) { 98 | Log.e(TAG, "Unable to write characteristic " + mUuid.toString()); 99 | mResult = false; 100 | break; 101 | } 102 | mResult = true; 103 | break; 104 | case ENABLE_NOTIFICATION: 105 | chr = getCharacteristic(mUuid); 106 | //Log.v(TAG, "Writing descriptor of " + chr.getUuid()); 107 | if (chr != null) { 108 | BluetoothGattDescriptor cccd = chr.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")); 109 | if (cccd != null) { 110 | int properties = chr.getProperties(); 111 | byte[] value; 112 | if ((properties & BluetoothGattCharacteristic.PROPERTY_NOTIFY) == BluetoothGattCharacteristic.PROPERTY_NOTIFY) { 113 | value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE; 114 | } else if ((properties & BluetoothGattCharacteristic.PROPERTY_INDICATE) == BluetoothGattCharacteristic.PROPERTY_INDICATE) { 115 | value = BluetoothGattDescriptor.ENABLE_INDICATION_VALUE; 116 | } else { 117 | Log.e(TAG, "Unable to start notifications on input characteristic"); 118 | mResult = false; 119 | return; 120 | } 121 | 122 | mGatt.setCharacteristicNotification(chr, true); 123 | cccd.setValue(value); 124 | if (!mGatt.writeDescriptor(cccd)) { 125 | Log.e(TAG, "Unable to write descriptor " + mUuid.toString()); 126 | mResult = false; 127 | return; 128 | } 129 | mResult = true; 130 | } 131 | } 132 | } 133 | } 134 | 135 | public boolean finish() { 136 | return mResult; 137 | } 138 | 139 | private BluetoothGattCharacteristic getCharacteristic(UUID uuid) { 140 | BluetoothGattService valveService = mGatt.getService(steamControllerService); 141 | if (valveService == null) 142 | return null; 143 | return valveService.getCharacteristic(uuid); 144 | } 145 | 146 | static public GattOperation readCharacteristic(BluetoothGatt gatt, UUID uuid) { 147 | return new GattOperation(gatt, Operation.CHR_READ, uuid); 148 | } 149 | 150 | static public GattOperation writeCharacteristic(BluetoothGatt gatt, UUID uuid, byte[] value) { 151 | return new GattOperation(gatt, Operation.CHR_WRITE, uuid, value); 152 | } 153 | 154 | static public GattOperation enableNotification(BluetoothGatt gatt, UUID uuid) { 155 | return new GattOperation(gatt, Operation.ENABLE_NOTIFICATION, uuid); 156 | } 157 | } 158 | 159 | public HIDDeviceBLESteamController(HIDDeviceManager manager, BluetoothDevice device) { 160 | mManager = manager; 161 | mDevice = device; 162 | mDeviceId = mManager.getDeviceIDForIdentifier(getIdentifier()); 163 | mIsRegistered = false; 164 | mIsChromebook = mManager.getContext().getPackageManager().hasSystemFeature("org.chromium.arc.device_management"); 165 | mOperations = new LinkedList(); 166 | mHandler = new Handler(Looper.getMainLooper()); 167 | 168 | mGatt = connectGatt(); 169 | // final HIDDeviceBLESteamController finalThis = this; 170 | // mHandler.postDelayed(new Runnable() { 171 | // @Override 172 | // public void run() { 173 | // finalThis.checkConnectionForChromebookIssue(); 174 | // } 175 | // }, CHROMEBOOK_CONNECTION_CHECK_INTERVAL); 176 | } 177 | 178 | public String getIdentifier() { 179 | return String.format("SteamController.%s", mDevice.getAddress()); 180 | } 181 | 182 | public BluetoothGatt getGatt() { 183 | return mGatt; 184 | } 185 | 186 | // Because on Chromebooks we show up as a dual-mode device, it will attempt to connect TRANSPORT_AUTO, which will use TRANSPORT_BREDR instead 187 | // of TRANSPORT_LE. Let's force ourselves to connect low energy. 188 | private BluetoothGatt connectGatt(boolean managed) { 189 | if (Build.VERSION.SDK_INT >= 23) { 190 | try { 191 | return mDevice.connectGatt(mManager.getContext(), managed, this, TRANSPORT_LE); 192 | } catch (Exception e) { 193 | return mDevice.connectGatt(mManager.getContext(), managed, this); 194 | } 195 | } else { 196 | return mDevice.connectGatt(mManager.getContext(), managed, this); 197 | } 198 | } 199 | 200 | private BluetoothGatt connectGatt() { 201 | return connectGatt(false); 202 | } 203 | 204 | protected int getConnectionState() { 205 | 206 | Context context = mManager.getContext(); 207 | if (context == null) { 208 | // We are lacking any context to get our Bluetooth information. We'll just assume disconnected. 209 | return BluetoothProfile.STATE_DISCONNECTED; 210 | } 211 | 212 | BluetoothManager btManager = (BluetoothManager)context.getSystemService(Context.BLUETOOTH_SERVICE); 213 | if (btManager == null) { 214 | // This device doesn't support Bluetooth. We should never be here, because how did 215 | // we instantiate a device to start with? 216 | return BluetoothProfile.STATE_DISCONNECTED; 217 | } 218 | 219 | return btManager.getConnectionState(mDevice, BluetoothProfile.GATT); 220 | } 221 | 222 | public void reconnect() { 223 | 224 | if (getConnectionState() != BluetoothProfile.STATE_CONNECTED) { 225 | mGatt.disconnect(); 226 | mGatt = connectGatt(); 227 | } 228 | 229 | } 230 | 231 | protected void checkConnectionForChromebookIssue() { 232 | if (!mIsChromebook) { 233 | // We only do this on Chromebooks, because otherwise it's really annoying to just attempt 234 | // over and over. 235 | return; 236 | } 237 | 238 | int connectionState = getConnectionState(); 239 | 240 | switch (connectionState) { 241 | case BluetoothProfile.STATE_CONNECTED: 242 | if (!mIsConnected) { 243 | // We are in the Bad Chromebook Place. We can force a disconnect 244 | // to try to recover. 245 | Log.v(TAG, "Chromebook: We are in a very bad state; the controller shows as connected in the underlying Bluetooth layer, but we never received a callback. Forcing a reconnect."); 246 | mIsReconnecting = true; 247 | mGatt.disconnect(); 248 | mGatt = connectGatt(false); 249 | break; 250 | } 251 | else if (!isRegistered()) { 252 | if (mGatt.getServices().size() > 0) { 253 | Log.v(TAG, "Chromebook: We are connected to a controller, but never got our registration. Trying to recover."); 254 | probeService(this); 255 | } 256 | else { 257 | Log.v(TAG, "Chromebook: We are connected to a controller, but never discovered services. Trying to recover."); 258 | mIsReconnecting = true; 259 | mGatt.disconnect(); 260 | mGatt = connectGatt(false); 261 | break; 262 | } 263 | } 264 | else { 265 | Log.v(TAG, "Chromebook: We are connected, and registered. Everything's good!"); 266 | return; 267 | } 268 | break; 269 | 270 | case BluetoothProfile.STATE_DISCONNECTED: 271 | Log.v(TAG, "Chromebook: We have either been disconnected, or the Chromebook BtGatt.ContextMap bug has bitten us. Attempting a disconnect/reconnect, but we may not be able to recover."); 272 | 273 | mIsReconnecting = true; 274 | mGatt.disconnect(); 275 | mGatt = connectGatt(false); 276 | break; 277 | 278 | case BluetoothProfile.STATE_CONNECTING: 279 | Log.v(TAG, "Chromebook: We're still trying to connect. Waiting a bit longer."); 280 | break; 281 | } 282 | 283 | final HIDDeviceBLESteamController finalThis = this; 284 | mHandler.postDelayed(new Runnable() { 285 | @Override 286 | public void run() { 287 | finalThis.checkConnectionForChromebookIssue(); 288 | } 289 | }, CHROMEBOOK_CONNECTION_CHECK_INTERVAL); 290 | } 291 | 292 | private boolean isRegistered() { 293 | return mIsRegistered; 294 | } 295 | 296 | private void setRegistered() { 297 | mIsRegistered = true; 298 | } 299 | 300 | private boolean probeService(HIDDeviceBLESteamController controller) { 301 | 302 | if (isRegistered()) { 303 | return true; 304 | } 305 | 306 | if (!mIsConnected) { 307 | return false; 308 | } 309 | 310 | Log.v(TAG, "probeService controller=" + controller); 311 | 312 | for (BluetoothGattService service : mGatt.getServices()) { 313 | if (service.getUuid().equals(steamControllerService)) { 314 | Log.v(TAG, "Found Valve steam controller service " + service.getUuid()); 315 | 316 | for (BluetoothGattCharacteristic chr : service.getCharacteristics()) { 317 | if (chr.getUuid().equals(inputCharacteristic)) { 318 | Log.v(TAG, "Found input characteristic"); 319 | // Start notifications 320 | BluetoothGattDescriptor cccd = chr.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")); 321 | if (cccd != null) { 322 | enableNotification(chr.getUuid()); 323 | } 324 | } 325 | } 326 | return true; 327 | } 328 | } 329 | 330 | if ((mGatt.getServices().size() == 0) && mIsChromebook && !mIsReconnecting) { 331 | Log.e(TAG, "Chromebook: Discovered services were empty; this almost certainly means the BtGatt.ContextMap bug has bitten us."); 332 | mIsConnected = false; 333 | mIsReconnecting = true; 334 | mGatt.disconnect(); 335 | mGatt = connectGatt(false); 336 | } 337 | 338 | return false; 339 | } 340 | 341 | ////////////////////////////////////////////////////////////////////////////////////////////////////// 342 | ////////////////////////////////////////////////////////////////////////////////////////////////////// 343 | ////////////////////////////////////////////////////////////////////////////////////////////////////// 344 | 345 | private void finishCurrentGattOperation() { 346 | GattOperation op = null; 347 | synchronized (mOperations) { 348 | if (mCurrentOperation != null) { 349 | op = mCurrentOperation; 350 | mCurrentOperation = null; 351 | } 352 | } 353 | if (op != null) { 354 | boolean result = op.finish(); // TODO: Maybe in main thread as well? 355 | 356 | // Our operation failed, let's add it back to the beginning of our queue. 357 | if (!result) { 358 | mOperations.addFirst(op); 359 | } 360 | } 361 | executeNextGattOperation(); 362 | } 363 | 364 | private void executeNextGattOperation() { 365 | synchronized (mOperations) { 366 | if (mCurrentOperation != null) 367 | return; 368 | 369 | if (mOperations.isEmpty()) 370 | return; 371 | 372 | mCurrentOperation = mOperations.removeFirst(); 373 | } 374 | 375 | // Run in main thread 376 | mHandler.post(new Runnable() { 377 | @Override 378 | public void run() { 379 | synchronized (mOperations) { 380 | if (mCurrentOperation == null) { 381 | Log.e(TAG, "Current operation null in executor?"); 382 | return; 383 | } 384 | 385 | mCurrentOperation.run(); 386 | // now wait for the GATT callback and when it comes, finish this operation 387 | } 388 | } 389 | }); 390 | } 391 | 392 | private void queueGattOperation(GattOperation op) { 393 | synchronized (mOperations) { 394 | mOperations.add(op); 395 | } 396 | executeNextGattOperation(); 397 | } 398 | 399 | private void enableNotification(UUID chrUuid) { 400 | GattOperation op = HIDDeviceBLESteamController.GattOperation.enableNotification(mGatt, chrUuid); 401 | queueGattOperation(op); 402 | } 403 | 404 | public void writeCharacteristic(UUID uuid, byte[] value) { 405 | GattOperation op = HIDDeviceBLESteamController.GattOperation.writeCharacteristic(mGatt, uuid, value); 406 | queueGattOperation(op); 407 | } 408 | 409 | public void readCharacteristic(UUID uuid) { 410 | GattOperation op = HIDDeviceBLESteamController.GattOperation.readCharacteristic(mGatt, uuid); 411 | queueGattOperation(op); 412 | } 413 | 414 | ////////////////////////////////////////////////////////////////////////////////////////////////////// 415 | ////////////// BluetoothGattCallback overridden methods 416 | ////////////////////////////////////////////////////////////////////////////////////////////////////// 417 | 418 | public void onConnectionStateChange(BluetoothGatt g, int status, int newState) { 419 | //Log.v(TAG, "onConnectionStateChange status=" + status + " newState=" + newState); 420 | mIsReconnecting = false; 421 | if (newState == 2) { 422 | mIsConnected = true; 423 | // Run directly, without GattOperation 424 | if (!isRegistered()) { 425 | mHandler.post(new Runnable() { 426 | @Override 427 | public void run() { 428 | mGatt.discoverServices(); 429 | } 430 | }); 431 | } 432 | } 433 | else if (newState == 0) { 434 | mIsConnected = false; 435 | } 436 | 437 | // Disconnection is handled in SteamLink using the ACTION_ACL_DISCONNECTED Intent. 438 | } 439 | 440 | public void onServicesDiscovered(BluetoothGatt gatt, int status) { 441 | //Log.v(TAG, "onServicesDiscovered status=" + status); 442 | if (status == 0) { 443 | if (gatt.getServices().size() == 0) { 444 | Log.v(TAG, "onServicesDiscovered returned zero services; something has gone horribly wrong down in Android's Bluetooth stack."); 445 | mIsReconnecting = true; 446 | mIsConnected = false; 447 | gatt.disconnect(); 448 | mGatt = connectGatt(false); 449 | } 450 | else { 451 | probeService(this); 452 | } 453 | } 454 | } 455 | 456 | public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { 457 | //Log.v(TAG, "onCharacteristicRead status=" + status + " uuid=" + characteristic.getUuid()); 458 | 459 | if (characteristic.getUuid().equals(reportCharacteristic) && !mFrozen) { 460 | mManager.HIDDeviceFeatureReport(getId(), characteristic.getValue()); 461 | } 462 | 463 | finishCurrentGattOperation(); 464 | } 465 | 466 | public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { 467 | //Log.v(TAG, "onCharacteristicWrite status=" + status + " uuid=" + characteristic.getUuid()); 468 | 469 | if (characteristic.getUuid().equals(reportCharacteristic)) { 470 | // Only register controller with the native side once it has been fully configured 471 | if (!isRegistered()) { 472 | Log.v(TAG, "Registering Steam Controller with ID: " + getId()); 473 | mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0); 474 | setRegistered(); 475 | } 476 | } 477 | 478 | finishCurrentGattOperation(); 479 | } 480 | 481 | public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { 482 | // Enable this for verbose logging of controller input reports 483 | //Log.v(TAG, "onCharacteristicChanged uuid=" + characteristic.getUuid() + " data=" + HexDump.dumpHexString(characteristic.getValue())); 484 | 485 | if (characteristic.getUuid().equals(inputCharacteristic) && !mFrozen) { 486 | mManager.HIDDeviceInputReport(getId(), characteristic.getValue()); 487 | } 488 | } 489 | 490 | public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { 491 | //Log.v(TAG, "onDescriptorRead status=" + status); 492 | } 493 | 494 | public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { 495 | BluetoothGattCharacteristic chr = descriptor.getCharacteristic(); 496 | //Log.v(TAG, "onDescriptorWrite status=" + status + " uuid=" + chr.getUuid() + " descriptor=" + descriptor.getUuid()); 497 | 498 | if (chr.getUuid().equals(inputCharacteristic)) { 499 | boolean hasWrittenInputDescriptor = true; 500 | BluetoothGattCharacteristic reportChr = chr.getService().getCharacteristic(reportCharacteristic); 501 | if (reportChr != null) { 502 | Log.v(TAG, "Writing report characteristic to enter valve mode"); 503 | reportChr.setValue(enterValveMode); 504 | gatt.writeCharacteristic(reportChr); 505 | } 506 | } 507 | 508 | finishCurrentGattOperation(); 509 | } 510 | 511 | public void onReliableWriteCompleted(BluetoothGatt gatt, int status) { 512 | //Log.v(TAG, "onReliableWriteCompleted status=" + status); 513 | } 514 | 515 | public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) { 516 | //Log.v(TAG, "onReadRemoteRssi status=" + status); 517 | } 518 | 519 | public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) { 520 | //Log.v(TAG, "onMtuChanged status=" + status); 521 | } 522 | 523 | ////////////////////////////////////////////////////////////////////////////////////////////////////// 524 | //////// Public API 525 | ////////////////////////////////////////////////////////////////////////////////////////////////////// 526 | 527 | @Override 528 | public int getId() { 529 | return mDeviceId; 530 | } 531 | 532 | @Override 533 | public int getVendorId() { 534 | // Valve Corporation 535 | final int VALVE_USB_VID = 0x28DE; 536 | return VALVE_USB_VID; 537 | } 538 | 539 | @Override 540 | public int getProductId() { 541 | // We don't have an easy way to query from the Bluetooth device, but we know what it is 542 | final int D0G_BLE2_PID = 0x1106; 543 | return D0G_BLE2_PID; 544 | } 545 | 546 | @Override 547 | public String getSerialNumber() { 548 | // This will be read later via feature report by Steam 549 | return "12345"; 550 | } 551 | 552 | @Override 553 | public int getVersion() { 554 | return 0; 555 | } 556 | 557 | @Override 558 | public String getManufacturerName() { 559 | return "Valve Corporation"; 560 | } 561 | 562 | @Override 563 | public String getProductName() { 564 | return "Steam Controller"; 565 | } 566 | 567 | @Override 568 | public UsbDevice getDevice() { 569 | return null; 570 | } 571 | 572 | @Override 573 | public boolean open() { 574 | return true; 575 | } 576 | 577 | @Override 578 | public int sendFeatureReport(byte[] report) { 579 | if (!isRegistered()) { 580 | Log.e(TAG, "Attempted sendFeatureReport before Steam Controller is registered!"); 581 | if (mIsConnected) { 582 | probeService(this); 583 | } 584 | return -1; 585 | } 586 | 587 | // We need to skip the first byte, as that doesn't go over the air 588 | byte[] actual_report = Arrays.copyOfRange(report, 1, report.length - 1); 589 | //Log.v(TAG, "sendFeatureReport " + HexDump.dumpHexString(actual_report)); 590 | writeCharacteristic(reportCharacteristic, actual_report); 591 | return report.length; 592 | } 593 | 594 | @Override 595 | public int sendOutputReport(byte[] report) { 596 | if (!isRegistered()) { 597 | Log.e(TAG, "Attempted sendOutputReport before Steam Controller is registered!"); 598 | if (mIsConnected) { 599 | probeService(this); 600 | } 601 | return -1; 602 | } 603 | 604 | //Log.v(TAG, "sendFeatureReport " + HexDump.dumpHexString(report)); 605 | writeCharacteristic(reportCharacteristic, report); 606 | return report.length; 607 | } 608 | 609 | @Override 610 | public boolean getFeatureReport(byte[] report) { 611 | if (!isRegistered()) { 612 | Log.e(TAG, "Attempted getFeatureReport before Steam Controller is registered!"); 613 | if (mIsConnected) { 614 | probeService(this); 615 | } 616 | return false; 617 | } 618 | 619 | //Log.v(TAG, "getFeatureReport"); 620 | readCharacteristic(reportCharacteristic); 621 | return true; 622 | } 623 | 624 | @Override 625 | public void close() { 626 | } 627 | 628 | @Override 629 | public void setFrozen(boolean frozen) { 630 | mFrozen = frozen; 631 | } 632 | 633 | @Override 634 | public void shutdown() { 635 | close(); 636 | 637 | BluetoothGatt g = mGatt; 638 | if (g != null) { 639 | g.disconnect(); 640 | g.close(); 641 | mGatt = null; 642 | } 643 | mManager = null; 644 | mIsRegistered = false; 645 | mIsConnected = false; 646 | mOperations.clear(); 647 | } 648 | 649 | } 650 | 651 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java: -------------------------------------------------------------------------------- 1 | package org.libsdl.app; 2 | 3 | import android.hardware.usb.*; 4 | import android.os.Build; 5 | import android.util.Log; 6 | import java.util.Arrays; 7 | 8 | class HIDDeviceUSB implements HIDDevice { 9 | 10 | private static final String TAG = "hidapi"; 11 | 12 | protected HIDDeviceManager mManager; 13 | protected UsbDevice mDevice; 14 | protected int mInterfaceIndex; 15 | protected int mInterface; 16 | protected int mDeviceId; 17 | protected UsbDeviceConnection mConnection; 18 | protected UsbEndpoint mInputEndpoint; 19 | protected UsbEndpoint mOutputEndpoint; 20 | protected InputThread mInputThread; 21 | protected boolean mRunning; 22 | protected boolean mFrozen; 23 | 24 | public HIDDeviceUSB(HIDDeviceManager manager, UsbDevice usbDevice, int interface_index) { 25 | mManager = manager; 26 | mDevice = usbDevice; 27 | mInterfaceIndex = interface_index; 28 | mInterface = mDevice.getInterface(mInterfaceIndex).getId(); 29 | mDeviceId = manager.getDeviceIDForIdentifier(getIdentifier()); 30 | mRunning = false; 31 | } 32 | 33 | public String getIdentifier() { 34 | return String.format("%s/%x/%x/%d", mDevice.getDeviceName(), mDevice.getVendorId(), mDevice.getProductId(), mInterfaceIndex); 35 | } 36 | 37 | @Override 38 | public int getId() { 39 | return mDeviceId; 40 | } 41 | 42 | @Override 43 | public int getVendorId() { 44 | return mDevice.getVendorId(); 45 | } 46 | 47 | @Override 48 | public int getProductId() { 49 | return mDevice.getProductId(); 50 | } 51 | 52 | @Override 53 | public String getSerialNumber() { 54 | String result = null; 55 | if (Build.VERSION.SDK_INT >= 21) { 56 | try { 57 | result = mDevice.getSerialNumber(); 58 | } 59 | catch (SecurityException exception) { 60 | //Log.w(TAG, "App permissions mean we cannot get serial number for device " + getDeviceName() + " message: " + exception.getMessage()); 61 | } 62 | } 63 | if (result == null) { 64 | result = ""; 65 | } 66 | return result; 67 | } 68 | 69 | @Override 70 | public int getVersion() { 71 | return 0; 72 | } 73 | 74 | @Override 75 | public String getManufacturerName() { 76 | String result = null; 77 | if (Build.VERSION.SDK_INT >= 21) { 78 | result = mDevice.getManufacturerName(); 79 | } 80 | if (result == null) { 81 | result = String.format("%x", getVendorId()); 82 | } 83 | return result; 84 | } 85 | 86 | @Override 87 | public String getProductName() { 88 | String result = null; 89 | if (Build.VERSION.SDK_INT >= 21) { 90 | result = mDevice.getProductName(); 91 | } 92 | if (result == null) { 93 | result = String.format("%x", getProductId()); 94 | } 95 | return result; 96 | } 97 | 98 | @Override 99 | public UsbDevice getDevice() { 100 | return mDevice; 101 | } 102 | 103 | public String getDeviceName() { 104 | return getManufacturerName() + " " + getProductName() + "(0x" + String.format("%x", getVendorId()) + "/0x" + String.format("%x", getProductId()) + ")"; 105 | } 106 | 107 | @Override 108 | public boolean open() { 109 | mConnection = mManager.getUSBManager().openDevice(mDevice); 110 | if (mConnection == null) { 111 | Log.w(TAG, "Unable to open USB device " + getDeviceName()); 112 | return false; 113 | } 114 | 115 | // Force claim our interface 116 | UsbInterface iface = mDevice.getInterface(mInterfaceIndex); 117 | if (!mConnection.claimInterface(iface, true)) { 118 | Log.w(TAG, "Failed to claim interfaces on USB device " + getDeviceName()); 119 | close(); 120 | return false; 121 | } 122 | 123 | // Find the endpoints 124 | for (int j = 0; j < iface.getEndpointCount(); j++) { 125 | UsbEndpoint endpt = iface.getEndpoint(j); 126 | switch (endpt.getDirection()) { 127 | case UsbConstants.USB_DIR_IN: 128 | if (mInputEndpoint == null) { 129 | mInputEndpoint = endpt; 130 | } 131 | break; 132 | case UsbConstants.USB_DIR_OUT: 133 | if (mOutputEndpoint == null) { 134 | mOutputEndpoint = endpt; 135 | } 136 | break; 137 | } 138 | } 139 | 140 | // Make sure the required endpoints were present 141 | if (mInputEndpoint == null || mOutputEndpoint == null) { 142 | Log.w(TAG, "Missing required endpoint on USB device " + getDeviceName()); 143 | close(); 144 | return false; 145 | } 146 | 147 | // Start listening for input 148 | mRunning = true; 149 | mInputThread = new InputThread(); 150 | mInputThread.start(); 151 | 152 | return true; 153 | } 154 | 155 | @Override 156 | public int sendFeatureReport(byte[] report) { 157 | int res = -1; 158 | int offset = 0; 159 | int length = report.length; 160 | boolean skipped_report_id = false; 161 | byte report_number = report[0]; 162 | 163 | if (report_number == 0x0) { 164 | ++offset; 165 | --length; 166 | skipped_report_id = true; 167 | } 168 | 169 | res = mConnection.controlTransfer( 170 | UsbConstants.USB_TYPE_CLASS | 0x01 /*RECIPIENT_INTERFACE*/ | UsbConstants.USB_DIR_OUT, 171 | 0x09/*HID set_report*/, 172 | (3/*HID feature*/ << 8) | report_number, 173 | mInterface, 174 | report, offset, length, 175 | 1000/*timeout millis*/); 176 | 177 | if (res < 0) { 178 | Log.w(TAG, "sendFeatureReport() returned " + res + " on device " + getDeviceName()); 179 | return -1; 180 | } 181 | 182 | if (skipped_report_id) { 183 | ++length; 184 | } 185 | return length; 186 | } 187 | 188 | @Override 189 | public int sendOutputReport(byte[] report) { 190 | int r = mConnection.bulkTransfer(mOutputEndpoint, report, report.length, 1000); 191 | if (r != report.length) { 192 | Log.w(TAG, "sendOutputReport() returned " + r + " on device " + getDeviceName()); 193 | } 194 | return r; 195 | } 196 | 197 | @Override 198 | public boolean getFeatureReport(byte[] report) { 199 | int res = -1; 200 | int offset = 0; 201 | int length = report.length; 202 | boolean skipped_report_id = false; 203 | byte report_number = report[0]; 204 | 205 | if (report_number == 0x0) { 206 | /* Offset the return buffer by 1, so that the report ID 207 | will remain in byte 0. */ 208 | ++offset; 209 | --length; 210 | skipped_report_id = true; 211 | } 212 | 213 | res = mConnection.controlTransfer( 214 | UsbConstants.USB_TYPE_CLASS | 0x01 /*RECIPIENT_INTERFACE*/ | UsbConstants.USB_DIR_IN, 215 | 0x01/*HID get_report*/, 216 | (3/*HID feature*/ << 8) | report_number, 217 | mInterface, 218 | report, offset, length, 219 | 1000/*timeout millis*/); 220 | 221 | if (res < 0) { 222 | Log.w(TAG, "getFeatureReport() returned " + res + " on device " + getDeviceName()); 223 | return false; 224 | } 225 | 226 | if (skipped_report_id) { 227 | ++res; 228 | ++length; 229 | } 230 | 231 | byte[] data; 232 | if (res == length) { 233 | data = report; 234 | } else { 235 | data = Arrays.copyOfRange(report, 0, res); 236 | } 237 | mManager.HIDDeviceFeatureReport(mDeviceId, data); 238 | 239 | return true; 240 | } 241 | 242 | @Override 243 | public void close() { 244 | mRunning = false; 245 | if (mInputThread != null) { 246 | while (mInputThread.isAlive()) { 247 | mInputThread.interrupt(); 248 | try { 249 | mInputThread.join(); 250 | } catch (InterruptedException e) { 251 | // Keep trying until we're done 252 | } 253 | } 254 | mInputThread = null; 255 | } 256 | if (mConnection != null) { 257 | UsbInterface iface = mDevice.getInterface(mInterfaceIndex); 258 | mConnection.releaseInterface(iface); 259 | mConnection.close(); 260 | mConnection = null; 261 | } 262 | } 263 | 264 | @Override 265 | public void shutdown() { 266 | close(); 267 | mManager = null; 268 | } 269 | 270 | @Override 271 | public void setFrozen(boolean frozen) { 272 | mFrozen = frozen; 273 | } 274 | 275 | protected class InputThread extends Thread { 276 | @Override 277 | public void run() { 278 | int packetSize = mInputEndpoint.getMaxPacketSize(); 279 | byte[] packet = new byte[packetSize]; 280 | while (mRunning) { 281 | int r; 282 | try 283 | { 284 | r = mConnection.bulkTransfer(mInputEndpoint, packet, packetSize, 1000); 285 | } 286 | catch (Exception e) 287 | { 288 | Log.v(TAG, "Exception in UsbDeviceConnection bulktransfer: " + e); 289 | break; 290 | } 291 | if (r < 0) { 292 | // Could be a timeout or an I/O error 293 | } 294 | if (r > 0) { 295 | byte[] data; 296 | if (r == packetSize) { 297 | data = packet; 298 | } else { 299 | data = Arrays.copyOfRange(packet, 0, r); 300 | } 301 | 302 | if (!mFrozen) { 303 | mManager.HIDDeviceInputReport(mDeviceId, data); 304 | } 305 | } 306 | } 307 | } 308 | } 309 | } 310 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/java/org/libsdl/app/SDL.java: -------------------------------------------------------------------------------- 1 | package org.libsdl.app; 2 | 3 | import android.content.Context; 4 | 5 | import java.lang.Class; 6 | import java.lang.reflect.Method; 7 | 8 | /** 9 | SDL library initialization 10 | */ 11 | public class SDL { 12 | 13 | // This function should be called first and sets up the native code 14 | // so it can call into the Java classes 15 | public static void setupJNI() { 16 | SDLActivity.nativeSetupJNI(); 17 | SDLAudioManager.nativeSetupJNI(); 18 | SDLControllerManager.nativeSetupJNI(); 19 | } 20 | 21 | // This function should be called each time the activity is started 22 | public static void initialize() { 23 | setContext(null); 24 | 25 | SDLActivity.initialize(); 26 | SDLAudioManager.initialize(); 27 | SDLControllerManager.initialize(); 28 | } 29 | 30 | // This function stores the current activity (SDL or not) 31 | public static void setContext(Context context) { 32 | mContext = context; 33 | } 34 | 35 | public static Context getContext() { 36 | return mContext; 37 | } 38 | 39 | public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException { 40 | 41 | if (libraryName == null) { 42 | throw new NullPointerException("No library name provided."); 43 | } 44 | 45 | try { 46 | // Let's see if we have ReLinker available in the project. This is necessary for 47 | // some projects that have huge numbers of local libraries bundled, and thus may 48 | // trip a bug in Android's native library loader which ReLinker works around. (If 49 | // loadLibrary works properly, ReLinker will simply use the normal Android method 50 | // internally.) 51 | // 52 | // To use ReLinker, just add it as a dependency. For more information, see 53 | // https://github.com/KeepSafe/ReLinker for ReLinker's repository. 54 | // 55 | Class relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker"); 56 | Class relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener"); 57 | Class contextClass = mContext.getClassLoader().loadClass("android.content.Context"); 58 | Class stringClass = mContext.getClassLoader().loadClass("java.lang.String"); 59 | 60 | // Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if 61 | // they've changed during updates. 62 | Method forceMethod = relinkClass.getDeclaredMethod("force"); 63 | Object relinkInstance = forceMethod.invoke(null); 64 | Class relinkInstanceClass = relinkInstance.getClass(); 65 | 66 | // Actually load the library! 67 | Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass); 68 | loadMethod.invoke(relinkInstance, mContext, libraryName, null, null); 69 | } 70 | catch (final Throwable e) { 71 | // Fall back 72 | try { 73 | System.loadLibrary(libraryName); 74 | } 75 | catch (final UnsatisfiedLinkError ule) { 76 | throw ule; 77 | } 78 | catch (final SecurityException se) { 79 | throw se; 80 | } 81 | } 82 | } 83 | 84 | protected static Context mContext; 85 | } 86 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/java/org/libsdl/app/SDLAudioManager.java: -------------------------------------------------------------------------------- 1 | package org.libsdl.app; 2 | 3 | import android.media.AudioFormat; 4 | import android.media.AudioManager; 5 | import android.media.AudioRecord; 6 | import android.media.AudioTrack; 7 | import android.media.MediaRecorder; 8 | import android.os.Build; 9 | import android.util.Log; 10 | 11 | public class SDLAudioManager 12 | { 13 | protected static final String TAG = "SDLAudio"; 14 | 15 | protected static AudioTrack mAudioTrack; 16 | protected static AudioRecord mAudioRecord; 17 | 18 | public static void initialize() { 19 | mAudioTrack = null; 20 | mAudioRecord = null; 21 | } 22 | 23 | // Audio 24 | 25 | protected static String getAudioFormatString(int audioFormat) { 26 | switch (audioFormat) { 27 | case AudioFormat.ENCODING_PCM_8BIT: 28 | return "8-bit"; 29 | case AudioFormat.ENCODING_PCM_16BIT: 30 | return "16-bit"; 31 | case AudioFormat.ENCODING_PCM_FLOAT: 32 | return "float"; 33 | default: 34 | return Integer.toString(audioFormat); 35 | } 36 | } 37 | 38 | protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) { 39 | int channelConfig; 40 | int sampleSize; 41 | int frameSize; 42 | 43 | Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", requested " + desiredFrames + " frames of " + desiredChannels + " channel " + getAudioFormatString(audioFormat) + " audio at " + sampleRate + " Hz"); 44 | 45 | /* On older devices let's use known good settings */ 46 | if (Build.VERSION.SDK_INT < 21) { 47 | if (desiredChannels > 2) { 48 | desiredChannels = 2; 49 | } 50 | if (sampleRate < 8000) { 51 | sampleRate = 8000; 52 | } else if (sampleRate > 48000) { 53 | sampleRate = 48000; 54 | } 55 | } 56 | 57 | if (audioFormat == AudioFormat.ENCODING_PCM_FLOAT) { 58 | int minSDKVersion = (isCapture ? 23 : 21); 59 | if (Build.VERSION.SDK_INT < minSDKVersion) { 60 | audioFormat = AudioFormat.ENCODING_PCM_16BIT; 61 | } 62 | } 63 | switch (audioFormat) 64 | { 65 | case AudioFormat.ENCODING_PCM_8BIT: 66 | sampleSize = 1; 67 | break; 68 | case AudioFormat.ENCODING_PCM_16BIT: 69 | sampleSize = 2; 70 | break; 71 | case AudioFormat.ENCODING_PCM_FLOAT: 72 | sampleSize = 4; 73 | break; 74 | default: 75 | Log.v(TAG, "Requested format " + audioFormat + ", getting ENCODING_PCM_16BIT"); 76 | audioFormat = AudioFormat.ENCODING_PCM_16BIT; 77 | sampleSize = 2; 78 | break; 79 | } 80 | 81 | if (isCapture) { 82 | switch (desiredChannels) { 83 | case 1: 84 | channelConfig = AudioFormat.CHANNEL_IN_MONO; 85 | break; 86 | case 2: 87 | channelConfig = AudioFormat.CHANNEL_IN_STEREO; 88 | break; 89 | default: 90 | Log.v(TAG, "Requested " + desiredChannels + " channels, getting stereo"); 91 | desiredChannels = 2; 92 | channelConfig = AudioFormat.CHANNEL_IN_STEREO; 93 | break; 94 | } 95 | } else { 96 | switch (desiredChannels) { 97 | case 1: 98 | channelConfig = AudioFormat.CHANNEL_OUT_MONO; 99 | break; 100 | case 2: 101 | channelConfig = AudioFormat.CHANNEL_OUT_STEREO; 102 | break; 103 | case 3: 104 | channelConfig = AudioFormat.CHANNEL_OUT_STEREO | AudioFormat.CHANNEL_OUT_FRONT_CENTER; 105 | break; 106 | case 4: 107 | channelConfig = AudioFormat.CHANNEL_OUT_QUAD; 108 | break; 109 | case 5: 110 | channelConfig = AudioFormat.CHANNEL_OUT_QUAD | AudioFormat.CHANNEL_OUT_FRONT_CENTER; 111 | break; 112 | case 6: 113 | channelConfig = AudioFormat.CHANNEL_OUT_5POINT1; 114 | break; 115 | case 7: 116 | channelConfig = AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER; 117 | break; 118 | case 8: 119 | if (Build.VERSION.SDK_INT >= 23) { 120 | channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; 121 | } else { 122 | Log.v(TAG, "Requested " + desiredChannels + " channels, getting 5.1 surround"); 123 | desiredChannels = 6; 124 | channelConfig = AudioFormat.CHANNEL_OUT_5POINT1; 125 | } 126 | break; 127 | default: 128 | Log.v(TAG, "Requested " + desiredChannels + " channels, getting stereo"); 129 | desiredChannels = 2; 130 | channelConfig = AudioFormat.CHANNEL_OUT_STEREO; 131 | break; 132 | } 133 | 134 | /* 135 | Log.v(TAG, "Speaker configuration (and order of channels):"); 136 | 137 | if ((channelConfig & 0x00000004) != 0) { 138 | Log.v(TAG, " CHANNEL_OUT_FRONT_LEFT"); 139 | } 140 | if ((channelConfig & 0x00000008) != 0) { 141 | Log.v(TAG, " CHANNEL_OUT_FRONT_RIGHT"); 142 | } 143 | if ((channelConfig & 0x00000010) != 0) { 144 | Log.v(TAG, " CHANNEL_OUT_FRONT_CENTER"); 145 | } 146 | if ((channelConfig & 0x00000020) != 0) { 147 | Log.v(TAG, " CHANNEL_OUT_LOW_FREQUENCY"); 148 | } 149 | if ((channelConfig & 0x00000040) != 0) { 150 | Log.v(TAG, " CHANNEL_OUT_BACK_LEFT"); 151 | } 152 | if ((channelConfig & 0x00000080) != 0) { 153 | Log.v(TAG, " CHANNEL_OUT_BACK_RIGHT"); 154 | } 155 | if ((channelConfig & 0x00000100) != 0) { 156 | Log.v(TAG, " CHANNEL_OUT_FRONT_LEFT_OF_CENTER"); 157 | } 158 | if ((channelConfig & 0x00000200) != 0) { 159 | Log.v(TAG, " CHANNEL_OUT_FRONT_RIGHT_OF_CENTER"); 160 | } 161 | if ((channelConfig & 0x00000400) != 0) { 162 | Log.v(TAG, " CHANNEL_OUT_BACK_CENTER"); 163 | } 164 | if ((channelConfig & 0x00000800) != 0) { 165 | Log.v(TAG, " CHANNEL_OUT_SIDE_LEFT"); 166 | } 167 | if ((channelConfig & 0x00001000) != 0) { 168 | Log.v(TAG, " CHANNEL_OUT_SIDE_RIGHT"); 169 | } 170 | */ 171 | } 172 | frameSize = (sampleSize * desiredChannels); 173 | 174 | // Let the user pick a larger buffer if they really want -- but ye 175 | // gods they probably shouldn't, the minimums are horrifyingly high 176 | // latency already 177 | int minBufferSize; 178 | if (isCapture) { 179 | minBufferSize = AudioRecord.getMinBufferSize(sampleRate, channelConfig, audioFormat); 180 | } else { 181 | minBufferSize = AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat); 182 | } 183 | desiredFrames = Math.max(desiredFrames, (minBufferSize + frameSize - 1) / frameSize); 184 | 185 | int[] results = new int[4]; 186 | 187 | if (isCapture) { 188 | if (mAudioRecord == null) { 189 | mAudioRecord = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, sampleRate, 190 | channelConfig, audioFormat, desiredFrames * frameSize); 191 | 192 | // see notes about AudioTrack state in audioOpen(), above. Probably also applies here. 193 | if (mAudioRecord.getState() != AudioRecord.STATE_INITIALIZED) { 194 | Log.e(TAG, "Failed during initialization of AudioRecord"); 195 | mAudioRecord.release(); 196 | mAudioRecord = null; 197 | return null; 198 | } 199 | 200 | mAudioRecord.startRecording(); 201 | } 202 | 203 | results[0] = mAudioRecord.getSampleRate(); 204 | results[1] = mAudioRecord.getAudioFormat(); 205 | results[2] = mAudioRecord.getChannelCount(); 206 | 207 | } else { 208 | if (mAudioTrack == null) { 209 | mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM); 210 | 211 | // Instantiating AudioTrack can "succeed" without an exception and the track may still be invalid 212 | // Ref: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/media/java/android/media/AudioTrack.java 213 | // Ref: http://developer.android.com/reference/android/media/AudioTrack.html#getState() 214 | if (mAudioTrack.getState() != AudioTrack.STATE_INITIALIZED) { 215 | /* Try again, with safer values */ 216 | 217 | Log.e(TAG, "Failed during initialization of Audio Track"); 218 | mAudioTrack.release(); 219 | mAudioTrack = null; 220 | return null; 221 | } 222 | 223 | mAudioTrack.play(); 224 | } 225 | 226 | results[0] = mAudioTrack.getSampleRate(); 227 | results[1] = mAudioTrack.getAudioFormat(); 228 | results[2] = mAudioTrack.getChannelCount(); 229 | } 230 | results[3] = desiredFrames; 231 | 232 | Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", got " + results[3] + " frames of " + results[2] + " channel " + getAudioFormatString(results[1]) + " audio at " + results[0] + " Hz"); 233 | 234 | return results; 235 | } 236 | 237 | /** 238 | * This method is called by SDL using JNI. 239 | */ 240 | public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) { 241 | return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames); 242 | } 243 | 244 | /** 245 | * This method is called by SDL using JNI. 246 | */ 247 | public static void audioWriteFloatBuffer(float[] buffer) { 248 | if (mAudioTrack == null) { 249 | Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); 250 | return; 251 | } 252 | 253 | for (int i = 0; i < buffer.length;) { 254 | int result = mAudioTrack.write(buffer, i, buffer.length - i, AudioTrack.WRITE_BLOCKING); 255 | if (result > 0) { 256 | i += result; 257 | } else if (result == 0) { 258 | try { 259 | Thread.sleep(1); 260 | } catch(InterruptedException e) { 261 | // Nom nom 262 | } 263 | } else { 264 | Log.w(TAG, "SDL audio: error return from write(float)"); 265 | return; 266 | } 267 | } 268 | } 269 | 270 | /** 271 | * This method is called by SDL using JNI. 272 | */ 273 | public static void audioWriteShortBuffer(short[] buffer) { 274 | if (mAudioTrack == null) { 275 | Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); 276 | return; 277 | } 278 | 279 | for (int i = 0; i < buffer.length;) { 280 | int result = mAudioTrack.write(buffer, i, buffer.length - i); 281 | if (result > 0) { 282 | i += result; 283 | } else if (result == 0) { 284 | try { 285 | Thread.sleep(1); 286 | } catch(InterruptedException e) { 287 | // Nom nom 288 | } 289 | } else { 290 | Log.w(TAG, "SDL audio: error return from write(short)"); 291 | return; 292 | } 293 | } 294 | } 295 | 296 | /** 297 | * This method is called by SDL using JNI. 298 | */ 299 | public static void audioWriteByteBuffer(byte[] buffer) { 300 | if (mAudioTrack == null) { 301 | Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); 302 | return; 303 | } 304 | 305 | for (int i = 0; i < buffer.length; ) { 306 | int result = mAudioTrack.write(buffer, i, buffer.length - i); 307 | if (result > 0) { 308 | i += result; 309 | } else if (result == 0) { 310 | try { 311 | Thread.sleep(1); 312 | } catch(InterruptedException e) { 313 | // Nom nom 314 | } 315 | } else { 316 | Log.w(TAG, "SDL audio: error return from write(byte)"); 317 | return; 318 | } 319 | } 320 | } 321 | 322 | /** 323 | * This method is called by SDL using JNI. 324 | */ 325 | public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) { 326 | return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames); 327 | } 328 | 329 | /** This method is called by SDL using JNI. */ 330 | public static int captureReadFloatBuffer(float[] buffer, boolean blocking) { 331 | return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); 332 | } 333 | 334 | /** This method is called by SDL using JNI. */ 335 | public static int captureReadShortBuffer(short[] buffer, boolean blocking) { 336 | if (Build.VERSION.SDK_INT < 23) { 337 | return mAudioRecord.read(buffer, 0, buffer.length); 338 | } else { 339 | return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); 340 | } 341 | } 342 | 343 | /** This method is called by SDL using JNI. */ 344 | public static int captureReadByteBuffer(byte[] buffer, boolean blocking) { 345 | if (Build.VERSION.SDK_INT < 23) { 346 | return mAudioRecord.read(buffer, 0, buffer.length); 347 | } else { 348 | return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); 349 | } 350 | } 351 | 352 | /** This method is called by SDL using JNI. */ 353 | public static void audioClose() { 354 | if (mAudioTrack != null) { 355 | mAudioTrack.stop(); 356 | mAudioTrack.release(); 357 | mAudioTrack = null; 358 | } 359 | } 360 | 361 | /** This method is called by SDL using JNI. */ 362 | public static void captureClose() { 363 | if (mAudioRecord != null) { 364 | mAudioRecord.stop(); 365 | mAudioRecord.release(); 366 | mAudioRecord = null; 367 | } 368 | } 369 | 370 | /** This method is called by SDL using JNI. */ 371 | public static void audioSetThreadPriority(boolean iscapture, int device_id) { 372 | try { 373 | 374 | /* Set thread name */ 375 | if (iscapture) { 376 | Thread.currentThread().setName("SDLAudioC" + device_id); 377 | } else { 378 | Thread.currentThread().setName("SDLAudioP" + device_id); 379 | } 380 | 381 | /* Set thread priority */ 382 | android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_AUDIO); 383 | 384 | } catch (Exception e) { 385 | Log.v(TAG, "modify thread properties failed " + e.toString()); 386 | } 387 | } 388 | 389 | public static native int nativeSetupJNI(); 390 | } 391 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallahn/sdl2vs/4b9a1540893cddda62d895ff865e8646048c6173/SDL2_GradleApp/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallahn/sdl2vs/4b9a1540893cddda62d895ff865e8646048c6173/SDL2_GradleApp/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallahn/sdl2vs/4b9a1540893cddda62d895ff865e8646048c6173/SDL2_GradleApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallahn/sdl2vs/4b9a1540893cddda62d895ff865e8646048c6173/SDL2_GradleApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallahn/sdl2vs/4b9a1540893cddda62d895ff865e8646048c6173/SDL2_GradleApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDL2_GradleApp 4 | 5 | -------------------------------------------------------------------------------- /SDL2_GradleApp/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SDL2_GradleApp/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | jcenter() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle-experimental:0.4.0' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | mavenCentral() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SDL2_GradleApp/build.gradle.template: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | jcenter() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:$(GradlePlugin)' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | mavenCentral() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SDL2_GradleApp/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallahn/sdl2vs/4b9a1540893cddda62d895ff865e8646048c6173/SDL2_GradleApp/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /SDL2_GradleApp/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip 6 | -------------------------------------------------------------------------------- /SDL2_GradleApp/gradle/wrapper/gradle-wrapper.properties.template: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-$(GradleVersion)-all.zip 6 | -------------------------------------------------------------------------------- /SDL2_GradleApp/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /SDL2_GradleApp/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /SDL2_GradleApp/settings.gradle.template: -------------------------------------------------------------------------------- 1 | include ':app' $(AarDependenciesSettings) 2 | -------------------------------------------------------------------------------- /SDL2_image/SDL2_image.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {a4f09d29-6a50-4a8f-b95a-b93752e3710a} 6 | 7 | 8 | {7664c67e-0d4a-4d5e-b122-36a2497742e7} 9 | 10 | 11 | {e3460442-db03-4b71-af59-913f2be498cd} 12 | 13 | 14 | {7f66960c-6724-49ee-ac25-55df1b79cb63} 15 | 16 | 17 | {df5b91c8-5153-404c-a491-d05d59339e8d} 18 | 19 | 20 | {4512edc5-ff62-4f3f-b834-32e846fe5990} 21 | 22 | 23 | {cb460206-12e6-47ef-826f-e68560baf9d6} 24 | 25 | 26 | {f0fb2951-fafe-41e6-87f1-4a87fe1d2e2d} 27 | 28 | 29 | {3c5541c7-99e4-4585-a8a9-e6ac46449ce8} 30 | 31 | 32 | {595bf529-d06c-4211-84ac-208be7464a8e} 33 | 34 | 35 | 36 | 37 | src 38 | 39 | 40 | src 41 | 42 | 43 | src 44 | 45 | 46 | src 47 | 48 | 49 | src 50 | 51 | 52 | src 53 | 54 | 55 | src 56 | 57 | 58 | src 59 | 60 | 61 | src 62 | 63 | 64 | src 65 | 66 | 67 | src 68 | 69 | 70 | src 71 | 72 | 73 | src 74 | 75 | 76 | src 77 | 78 | 79 | src 80 | 81 | 82 | src 83 | 84 | 85 | src 86 | 87 | 88 | src\jpeg 89 | 90 | 91 | src\jpeg 92 | 93 | 94 | src\jpeg 95 | 96 | 97 | src\jpeg 98 | 99 | 100 | src\jpeg 101 | 102 | 103 | src\jpeg 104 | 105 | 106 | src\jpeg 107 | 108 | 109 | src\jpeg 110 | 111 | 112 | src\jpeg 113 | 114 | 115 | src\jpeg 116 | 117 | 118 | src\jpeg 119 | 120 | 121 | src\jpeg 122 | 123 | 124 | src\jpeg 125 | 126 | 127 | src\jpeg 128 | 129 | 130 | src\jpeg 131 | 132 | 133 | src\jpeg 134 | 135 | 136 | src\jpeg 137 | 138 | 139 | src\jpeg 140 | 141 | 142 | src\jpeg 143 | 144 | 145 | src\jpeg 146 | 147 | 148 | src\jpeg 149 | 150 | 151 | src\jpeg 152 | 153 | 154 | src\jpeg 155 | 156 | 157 | src\jpeg 158 | 159 | 160 | src\jpeg 161 | 162 | 163 | src\jpeg 164 | 165 | 166 | src\jpeg 167 | 168 | 169 | src\jpeg 170 | 171 | 172 | src\jpeg 173 | 174 | 175 | src\jpeg 176 | 177 | 178 | src\jpeg 179 | 180 | 181 | src\jpeg 182 | 183 | 184 | src\jpeg 185 | 186 | 187 | src\jpeg 188 | 189 | 190 | src\jpeg 191 | 192 | 193 | src\jpeg 194 | 195 | 196 | src\jpeg 197 | 198 | 199 | src\jpeg 200 | 201 | 202 | src\jpeg 203 | 204 | 205 | src\jpeg 206 | 207 | 208 | src\jpeg 209 | 210 | 211 | src\jpeg 212 | 213 | 214 | src\jpeg 215 | 216 | 217 | src\jpeg 218 | 219 | 220 | src\png 221 | 222 | 223 | src\png 224 | 225 | 226 | src\png 227 | 228 | 229 | src\png 230 | 231 | 232 | src\png 233 | 234 | 235 | src\png 236 | 237 | 238 | src\png 239 | 240 | 241 | src\png 242 | 243 | 244 | src\png 245 | 246 | 247 | src\png 248 | 249 | 250 | src\png 251 | 252 | 253 | src\png 254 | 255 | 256 | src\png 257 | 258 | 259 | src\png 260 | 261 | 262 | src\png 263 | 264 | 265 | src\png\arm 266 | 267 | 268 | src\png\arm 269 | 270 | 271 | src\png\arm 272 | 273 | 274 | src\jpeg 275 | 276 | 277 | src\jpeg 278 | 279 | 280 | src\webp\dec 281 | 282 | 283 | src\webp\dec 284 | 285 | 286 | src\webp\dec 287 | 288 | 289 | src\webp\dec 290 | 291 | 292 | src\webp\dec 293 | 294 | 295 | src\webp\dec 296 | 297 | 298 | src\webp\dec 299 | 300 | 301 | src\webp\dec 302 | 303 | 304 | src\webp\dec 305 | 306 | 307 | src\webp\dec 308 | 309 | 310 | src\webp\dsp 311 | 312 | 313 | src\webp\dsp 314 | 315 | 316 | src\webp\dsp 317 | 318 | 319 | src\webp\dsp 320 | 321 | 322 | src\webp\dsp 323 | 324 | 325 | src\webp\dsp 326 | 327 | 328 | src\webp\dsp 329 | 330 | 331 | src\webp\dsp 332 | 333 | 334 | src\webp\dsp 335 | 336 | 337 | src\webp\dsp 338 | 339 | 340 | src\webp\dsp 341 | 342 | 343 | src\webp\dsp 344 | 345 | 346 | src\webp\dsp 347 | 348 | 349 | src\webp\dsp 350 | 351 | 352 | src\webp\dsp 353 | 354 | 355 | src\webp\dsp 356 | 357 | 358 | src\webp\dsp 359 | 360 | 361 | src\webp\dsp 362 | 363 | 364 | src\webp\dsp 365 | 366 | 367 | src\webp\dsp 368 | 369 | 370 | src\webp\dsp 371 | 372 | 373 | src\webp\dsp 374 | 375 | 376 | src\webp\dsp 377 | 378 | 379 | src\webp\dsp 380 | 381 | 382 | src\webp\dsp 383 | 384 | 385 | src\webp\dsp 386 | 387 | 388 | src\webp\dsp 389 | 390 | 391 | src\webp\dsp 392 | 393 | 394 | src\webp\dsp 395 | 396 | 397 | src\webp\dsp 398 | 399 | 400 | src\webp\dsp 401 | 402 | 403 | src\webp\dsp 404 | 405 | 406 | src\webp\dsp 407 | 408 | 409 | src\webp\dsp 410 | 411 | 412 | src\webp\dsp 413 | 414 | 415 | src\webp\dsp 416 | 417 | 418 | src\webp\dsp 419 | 420 | 421 | src\webp\dsp 422 | 423 | 424 | src\webp\dsp 425 | 426 | 427 | src\webp\dsp 428 | 429 | 430 | src\webp\dsp 431 | 432 | 433 | src\webp\dsp 434 | 435 | 436 | src\webp\utils 437 | 438 | 439 | src\webp\utils 440 | 441 | 442 | src\webp\utils 443 | 444 | 445 | src\webp\utils 446 | 447 | 448 | src\webp\utils 449 | 450 | 451 | src\webp\utils 452 | 453 | 454 | src\webp\utils 455 | 456 | 457 | src\webp\utils 458 | 459 | 460 | src\webp\utils 461 | 462 | 463 | src\zlib 464 | 465 | 466 | src\zlib 467 | 468 | 469 | src\zlib 470 | 471 | 472 | src\zlib 473 | 474 | 475 | src\zlib 476 | 477 | 478 | src\zlib 479 | 480 | 481 | src\zlib 482 | 483 | 484 | src\zlib 485 | 486 | 487 | src\zlib 488 | 489 | 490 | src\zlib 491 | 492 | 493 | src\zlib 494 | 495 | 496 | src\zlib 497 | 498 | 499 | src\zlib 500 | 501 | 502 | src\zlib 503 | 504 | 505 | src\zlib 506 | 507 | 508 | 509 | 510 | include 511 | 512 | 513 | -------------------------------------------------------------------------------- /SDL2_project.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28721.148 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL2\SDL2.vcxproj", "{B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "main", "main\main.vcxproj", "{B7F3A6F1-0359-4427-925D-4A6D1C979B61}" 9 | EndProject 10 | Project("{39E2626F-3545-4960-A6E8-258AD8476CE5}") = "SDL2_GradleApp", "SDL2_GradleApp\SDL2_GradleApp.androidproj", "{F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2_image", "SDL2_image\SDL2_image.vcxproj", "{03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2_ttf", "SDL2_ttf\SDL2_ttf.vcxproj", "{8572235C-B335-40DD-BA5F-9954BEDC4BFC}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidapi", "SDL2\src\hidapi\android\hidapi.vcxproj", "{654D6F15-267A-423D-8606-351C153C4E3D}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|ARM = Debug|ARM 21 | Debug|ARM64 = Debug|ARM64 22 | Debug|x64 = Debug|x64 23 | Debug|x86 = Debug|x86 24 | Release|ARM = Release|ARM 25 | Release|ARM64 = Release|ARM64 26 | Release|x64 = Release|x64 27 | Release|x86 = Release|x86 28 | EndGlobalSection 29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 30 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Debug|ARM.ActiveCfg = Debug|ARM 31 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Debug|ARM.Build.0 = Debug|ARM 32 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Debug|ARM64.ActiveCfg = Debug|ARM64 33 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Debug|ARM64.Build.0 = Debug|ARM64 34 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Debug|x64.ActiveCfg = Debug|x64 35 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Debug|x64.Build.0 = Debug|x64 36 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Debug|x86.ActiveCfg = Debug|x86 37 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Debug|x86.Build.0 = Debug|x86 38 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Release|ARM.ActiveCfg = Release|ARM 39 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Release|ARM.Build.0 = Release|ARM 40 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Release|ARM64.ActiveCfg = Release|ARM64 41 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Release|ARM64.Build.0 = Release|ARM64 42 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Release|x64.ActiveCfg = Release|x64 43 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Release|x64.Build.0 = Release|x64 44 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Release|x86.ActiveCfg = Release|x86 45 | {B7BE417C-B6C5-4A69-A056-E0CB0C6A344C}.Release|x86.Build.0 = Release|x86 46 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Debug|ARM.ActiveCfg = Debug|ARM 47 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Debug|ARM.Build.0 = Debug|ARM 48 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Debug|ARM64.ActiveCfg = Debug|ARM64 49 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Debug|ARM64.Build.0 = Debug|ARM64 50 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Debug|x64.ActiveCfg = Debug|x64 51 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Debug|x64.Build.0 = Debug|x64 52 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Debug|x86.ActiveCfg = Debug|x86 53 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Debug|x86.Build.0 = Debug|x86 54 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Release|ARM.ActiveCfg = Release|ARM 55 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Release|ARM.Build.0 = Release|ARM 56 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Release|ARM64.ActiveCfg = Release|ARM64 57 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Release|ARM64.Build.0 = Release|ARM64 58 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Release|x64.ActiveCfg = Release|x64 59 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Release|x64.Build.0 = Release|x64 60 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Release|x86.ActiveCfg = Release|x86 61 | {B7F3A6F1-0359-4427-925D-4A6D1C979B61}.Release|x86.Build.0 = Release|x86 62 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|ARM.ActiveCfg = Debug|ARM 63 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|ARM.Build.0 = Debug|ARM 64 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|ARM.Deploy.0 = Debug|ARM 65 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|ARM64.ActiveCfg = Debug|ARM64 66 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|ARM64.Build.0 = Debug|ARM64 67 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|ARM64.Deploy.0 = Debug|ARM64 68 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|x64.ActiveCfg = Debug|x64 69 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|x64.Build.0 = Debug|x64 70 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|x64.Deploy.0 = Debug|x64 71 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|x86.ActiveCfg = Debug|x86 72 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|x86.Build.0 = Debug|x86 73 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Debug|x86.Deploy.0 = Debug|x86 74 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|ARM.ActiveCfg = Release|ARM 75 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|ARM.Build.0 = Release|ARM 76 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|ARM.Deploy.0 = Release|ARM 77 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|ARM64.ActiveCfg = Release|ARM64 78 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|ARM64.Build.0 = Release|ARM64 79 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|ARM64.Deploy.0 = Release|ARM64 80 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|x64.ActiveCfg = Release|x64 81 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|x64.Build.0 = Release|x64 82 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|x64.Deploy.0 = Release|x64 83 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|x86.ActiveCfg = Release|x86 84 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|x86.Build.0 = Release|x86 85 | {F38408B0-8D17-4D2B-AEB4-5FA30B7F6373}.Release|x86.Deploy.0 = Release|x86 86 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Debug|ARM.ActiveCfg = Debug|ARM 87 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Debug|ARM.Build.0 = Debug|ARM 88 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Debug|ARM64.ActiveCfg = Debug|ARM64 89 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Debug|ARM64.Build.0 = Debug|ARM64 90 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Debug|x64.ActiveCfg = Debug|x64 91 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Debug|x64.Build.0 = Debug|x64 92 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Debug|x86.ActiveCfg = Debug|x86 93 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Debug|x86.Build.0 = Debug|x86 94 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Release|ARM.ActiveCfg = Release|ARM 95 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Release|ARM.Build.0 = Release|ARM 96 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Release|ARM64.ActiveCfg = Release|ARM64 97 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Release|ARM64.Build.0 = Release|ARM64 98 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Release|x64.ActiveCfg = Release|x64 99 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Release|x64.Build.0 = Release|x64 100 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Release|x86.ActiveCfg = Release|x86 101 | {03A9401D-CEFF-4F5E-A7B4-FC2A0D9F6C95}.Release|x86.Build.0 = Release|x86 102 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Debug|ARM.ActiveCfg = Debug|ARM 103 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Debug|ARM.Build.0 = Debug|ARM 104 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Debug|ARM64.ActiveCfg = Debug|ARM64 105 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Debug|ARM64.Build.0 = Debug|ARM64 106 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Debug|x64.ActiveCfg = Debug|x64 107 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Debug|x64.Build.0 = Debug|x64 108 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Debug|x86.ActiveCfg = Debug|x86 109 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Debug|x86.Build.0 = Debug|x86 110 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Release|ARM.ActiveCfg = Release|ARM 111 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Release|ARM.Build.0 = Release|ARM 112 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Release|ARM64.ActiveCfg = Release|ARM64 113 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Release|ARM64.Build.0 = Release|ARM64 114 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Release|x64.ActiveCfg = Release|x64 115 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Release|x64.Build.0 = Release|x64 116 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Release|x86.ActiveCfg = Release|x86 117 | {8572235C-B335-40DD-BA5F-9954BEDC4BFC}.Release|x86.Build.0 = Release|x86 118 | {654D6F15-267A-423D-8606-351C153C4E3D}.Debug|ARM.ActiveCfg = Debug|ARM 119 | {654D6F15-267A-423D-8606-351C153C4E3D}.Debug|ARM.Build.0 = Debug|ARM 120 | {654D6F15-267A-423D-8606-351C153C4E3D}.Debug|ARM64.ActiveCfg = Debug|ARM64 121 | {654D6F15-267A-423D-8606-351C153C4E3D}.Debug|ARM64.Build.0 = Debug|ARM64 122 | {654D6F15-267A-423D-8606-351C153C4E3D}.Debug|x64.ActiveCfg = Debug|x64 123 | {654D6F15-267A-423D-8606-351C153C4E3D}.Debug|x64.Build.0 = Debug|x64 124 | {654D6F15-267A-423D-8606-351C153C4E3D}.Debug|x86.ActiveCfg = Debug|x86 125 | {654D6F15-267A-423D-8606-351C153C4E3D}.Debug|x86.Build.0 = Debug|x86 126 | {654D6F15-267A-423D-8606-351C153C4E3D}.Release|ARM.ActiveCfg = Release|ARM 127 | {654D6F15-267A-423D-8606-351C153C4E3D}.Release|ARM.Build.0 = Release|ARM 128 | {654D6F15-267A-423D-8606-351C153C4E3D}.Release|ARM64.ActiveCfg = Release|ARM64 129 | {654D6F15-267A-423D-8606-351C153C4E3D}.Release|ARM64.Build.0 = Release|ARM64 130 | {654D6F15-267A-423D-8606-351C153C4E3D}.Release|x64.ActiveCfg = Release|x64 131 | {654D6F15-267A-423D-8606-351C153C4E3D}.Release|x64.Build.0 = Release|x64 132 | {654D6F15-267A-423D-8606-351C153C4E3D}.Release|x86.ActiveCfg = Release|x86 133 | {654D6F15-267A-423D-8606-351C153C4E3D}.Release|x86.Build.0 = Release|x86 134 | EndGlobalSection 135 | GlobalSection(SolutionProperties) = preSolution 136 | HideSolutionNode = FALSE 137 | EndGlobalSection 138 | GlobalSection(ExtensibilityGlobals) = postSolution 139 | SolutionGuid = {5F9E227F-8F40-42A4-B967-E23FBBAAD8A3} 140 | EndGlobalSection 141 | EndGlobal 142 | -------------------------------------------------------------------------------- /SDL2_ttf/SDL2_ttf.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | ARM 7 | 8 | 9 | Release 10 | ARM 11 | 12 | 13 | Debug 14 | ARM64 15 | 16 | 17 | Release 18 | ARM64 19 | 20 | 21 | Debug 22 | x64 23 | 24 | 25 | Release 26 | x64 27 | 28 | 29 | Debug 30 | x86 31 | 32 | 33 | Release 34 | x86 35 | 36 | 37 | 38 | 39 | {b7be417c-b6c5-4a69-a056-e0cb0c6a344c} 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | {8572235c-b335-40dd-ba5f-9954bedc4bfc} 91 | Android 92 | SDL2_ttf 93 | 14.0 94 | Android 95 | 3.0 96 | 97 | 98 | 99 | DynamicLibrary 100 | true 101 | Clang_5_0 102 | android-26 103 | 104 | 105 | DynamicLibrary 106 | false 107 | Clang_5_0 108 | android-26 109 | 110 | 111 | DynamicLibrary 112 | true 113 | Clang_5_0 114 | android-26 115 | 116 | 117 | DynamicLibrary 118 | false 119 | Clang_5_0 120 | android-26 121 | 122 | 123 | DynamicLibrary 124 | true 125 | Clang_5_0 126 | android-26 127 | 128 | 129 | DynamicLibrary 130 | false 131 | Clang_5_0 132 | android-26 133 | 134 | 135 | DynamicLibrary 136 | true 137 | Clang_5_0 138 | android-26 139 | 140 | 141 | DynamicLibrary 142 | false 143 | Clang_5_0 144 | android-26 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL_ttf\external\freetype-2.10.4\include;..\libsdl\SDL\include 170 | FT2_BUILD_LIBRARY;%(PreprocessorDefinitions) 171 | c++1z 172 | 173 | 174 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 175 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 176 | 177 | 178 | 179 | 180 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL_ttf\external\freetype-2.10.4\include;..\libsdl\SDL\include 181 | FT2_BUILD_LIBRARY;%(PreprocessorDefinitions) 182 | c++1z 183 | 184 | 185 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 186 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 187 | 188 | 189 | 190 | 191 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL_ttf\external\freetype-2.10.4\include;..\libsdl\SDL\include 192 | FT2_BUILD_LIBRARY;%(PreprocessorDefinitions) 193 | c++1z 194 | 195 | 196 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 197 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 198 | 199 | 200 | 201 | 202 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL_ttf\external\freetype-2.10.4\include;..\libsdl\SDL\include 203 | FT2_BUILD_LIBRARY;%(PreprocessorDefinitions) 204 | c++1z 205 | 206 | 207 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 208 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 209 | 210 | 211 | 212 | 213 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL_ttf\external\freetype-2.10.4\include;..\libsdl\SDL\include 214 | FT2_BUILD_LIBRARY;%(PreprocessorDefinitions) 215 | c++1z 216 | 217 | 218 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 219 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 220 | 221 | 222 | 223 | 224 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL_ttf\external\freetype-2.10.4\include;..\libsdl\SDL\include 225 | FT2_BUILD_LIBRARY;%(PreprocessorDefinitions) 226 | c++1z 227 | 228 | 229 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 230 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 231 | 232 | 233 | 234 | 235 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL_ttf\external\freetype-2.10.4\include;..\libsdl\SDL\include 236 | FT2_BUILD_LIBRARY;%(PreprocessorDefinitions) 237 | true 238 | c++1z 239 | 240 | 241 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 242 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 243 | 244 | 245 | 246 | 247 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL_ttf\external\freetype-2.10.4\include;..\libsdl\SDL\include 248 | FT2_BUILD_LIBRARY;%(PreprocessorDefinitions) 249 | true 250 | c++1z 251 | 252 | 253 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 254 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 255 | 256 | 257 | 258 | 259 | -------------------------------------------------------------------------------- /SDL2_ttf/SDL2_ttf.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {9318c3ab-a7c1-4372-88fa-1c2ceed86c86} 6 | 7 | 8 | {aa851c54-dc97-4c0c-a852-b0346eef4f1b} 9 | 10 | 11 | {a380599b-6140-4787-ab22-c5d8f34d7cfd} 12 | 13 | 14 | {02ee8a27-c6e0-472e-b919-177e5a142209} 15 | 16 | 17 | {7ef3b1ff-012c-4daa-ac94-835ea4b8af30} 18 | 19 | 20 | {744a03f5-522e-4389-91dc-6781405146d4} 21 | 22 | 23 | {6b1caa27-106c-47e7-8136-d7824b593cba} 24 | 25 | 26 | {e7079fac-1c39-4a9a-a385-8e9295c7a335} 27 | 28 | 29 | {c9e0e3d1-3055-4a1d-a971-1de92c30a25c} 30 | 31 | 32 | {5fd40cf5-e9f2-40be-8be4-ba50272609a4} 33 | 34 | 35 | {dd6ea6aa-3365-4aa5-a61d-e427dca7856b} 36 | 37 | 38 | {df8d80ea-292c-42de-8ec7-e2866a6562f4} 39 | 40 | 41 | {2cbe9113-bf21-4cf5-989c-5d9c2f424d9f} 42 | 43 | 44 | {d2c964e4-f7f0-46c8-99c7-196460e11ed8} 45 | 46 | 47 | {c4fe6ea5-86f5-41c3-9fff-8201934de440} 48 | 49 | 50 | {2f147867-bd6a-4372-ba06-06d59a4a202c} 51 | 52 | 53 | {70cc32ef-4934-4f16-a174-8373f2dcd686} 54 | 55 | 56 | {e82304d2-8e40-4681-9777-7e7de5554103} 57 | 58 | 59 | {d4743f82-0006-47c5-988f-5244a49ed84a} 60 | 61 | 62 | {12f6c997-77b5-4191-a859-bb35a44388aa} 63 | 64 | 65 | {ef424ad7-5d5f-4851-a2a7-9e891685d683} 66 | 67 | 68 | {944ecc84-19ab-47d7-ae25-f606de27b514} 69 | 70 | 71 | {7134e27a-6f20-468d-b19f-8a8669999ce9} 72 | 73 | 74 | {4d41ef7f-b5a2-4923-9e60-8e05b64b3ae1} 75 | 76 | 77 | {7a176512-80a8-46df-a565-9e7ce6c3f65a} 78 | 79 | 80 | 81 | 82 | src\freetype\base 83 | 84 | 85 | src\freetype\base 86 | 87 | 88 | src\freetype\base 89 | 90 | 91 | src\freetype\base 92 | 93 | 94 | src\freetype\base 95 | 96 | 97 | src\freetype\base 98 | 99 | 100 | src\freetype\base 101 | 102 | 103 | src\freetype\base 104 | 105 | 106 | src\freetype\base 107 | 108 | 109 | src\freetype\base 110 | 111 | 112 | src\freetype\base 113 | 114 | 115 | src\freetype\base 116 | 117 | 118 | src\freetype\base 119 | 120 | 121 | src\freetype\base 122 | 123 | 124 | src\freetype\base 125 | 126 | 127 | src\freetype\base 128 | 129 | 130 | src\freetype\base 131 | 132 | 133 | src\freetype\base 134 | 135 | 136 | src\freetype\base 137 | 138 | 139 | src\freetype\base 140 | 141 | 142 | src\freetype\autofit 143 | 144 | 145 | src\freetype\bdf 146 | 147 | 148 | src\freetype\bzip2 149 | 150 | 151 | src\freetype\cache 152 | 153 | 154 | src\freetype\cff 155 | 156 | 157 | src\freetype\cid 158 | 159 | 160 | src\freetype\gzip 161 | 162 | 163 | src\freetype\lzw 164 | 165 | 166 | src\freetype\pcf 167 | 168 | 169 | src\freetype\pfr 170 | 171 | 172 | src\freetype\psaux 173 | 174 | 175 | src\freetype\pshinter 176 | 177 | 178 | src\freetype\psnames 179 | 180 | 181 | src\freetype\raster 182 | 183 | 184 | src\freetype\sfnt 185 | 186 | 187 | src\freetype\smooth 188 | 189 | 190 | src\freetype\tools 191 | 192 | 193 | src\freetype\truetype 194 | 195 | 196 | src\freetype\type1 197 | 198 | 199 | src\freetype\type42 200 | 201 | 202 | src\freetype\winfonts 203 | 204 | 205 | src 206 | 207 | 208 | 209 | 210 | include 211 | 212 | 213 | -------------------------------------------------------------------------------- /main/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char** argsv) 5 | { 6 | //put your SDL / game code here 7 | 8 | SDL_Window *window; // Declare a pointer 9 | 10 | SDL_Init(SDL_INIT_VIDEO); // Initialize SDL2 11 | TTF_Init(); 12 | // Create an application window with the following settings: 13 | window = SDL_CreateWindow( 14 | "An SDL2 window", // window title 15 | SDL_WINDOWPOS_UNDEFINED, // initial x position 16 | SDL_WINDOWPOS_UNDEFINED, // initial y position 17 | 640, // width, in pixels 18 | 480, // height, in pixels 19 | SDL_WINDOW_OPENGL // flags - see below 20 | ); 21 | 22 | // Check that the window was successfully created 23 | if (window == NULL) { 24 | // In the case that the window could not be made... 25 | SDL_Log("Could not create window: %s\n", SDL_GetError()); 26 | return 1; 27 | } 28 | 29 | SDL_Renderer* renderer = NULL; 30 | renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); 31 | 32 | TTF_Font* font = TTF_OpenFontRW(SDL_RWFromFile("fonts/OpenSans-Regular.ttf", "rb"), 1, 24); 33 | if (!font) 34 | { 35 | SDL_Log("Could not load font %s\n", SDL_GetError()); 36 | } 37 | SDL_Color textColor = { 255, 255, 255, 0 }; 38 | SDL_Surface* surface = TTF_RenderText_Solid(font, "Hello World", textColor); 39 | SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface); 40 | SDL_Rect rect_tex = { 200, 200, surface ? surface->w : 0, surface ? surface->h : 0 }; 41 | SDL_FreeSurface(surface); 42 | 43 | while (1) { 44 | SDL_Event e; 45 | if (SDL_PollEvent(&e)) { 46 | if (e.type == SDL_QUIT) { 47 | break; 48 | } 49 | } 50 | 51 | SDL_SetRenderDrawColor(renderer, 0x0, 0x0, 0x0, 0xff); 52 | SDL_RenderClear(renderer); 53 | SDL_SetRenderDrawColor(renderer, 0xff, 0x00, 0x00, 0xff); 54 | SDL_Rect rect = {100, 100, 200, 200}; 55 | SDL_RenderFillRect(renderer, &rect); 56 | if (texture) 57 | SDL_RenderCopy(renderer, texture, NULL, &rect_tex); 58 | SDL_RenderPresent(renderer); 59 | } 60 | if (texture) 61 | SDL_DestroyTexture(texture); 62 | if (renderer) 63 | SDL_DestroyRenderer(renderer); 64 | 65 | // Close and destroy the window 66 | SDL_DestroyWindow(window); 67 | 68 | // Clean up 69 | TTF_Quit(); 70 | SDL_Quit(); 71 | 72 | return 0; 73 | } -------------------------------------------------------------------------------- /main/main.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | ARM 7 | 8 | 9 | Release 10 | ARM 11 | 12 | 13 | Debug 14 | ARM64 15 | 16 | 17 | Release 18 | ARM64 19 | 20 | 21 | Debug 22 | x64 23 | 24 | 25 | Release 26 | x64 27 | 28 | 29 | Debug 30 | x86 31 | 32 | 33 | Release 34 | x86 35 | 36 | 37 | 38 | {b7f3a6f1-0359-4427-925d-4a6d1c979b61} 39 | Android 40 | main 41 | 14.0 42 | Android 43 | 3.0 44 | 45 | 46 | 47 | DynamicLibrary 48 | true 49 | Clang_5_0 50 | android-26 51 | 52 | 53 | DynamicLibrary 54 | false 55 | Clang_5_0 56 | android-26 57 | 58 | 59 | DynamicLibrary 60 | true 61 | Clang_5_0 62 | android-26 63 | 64 | 65 | DynamicLibrary 66 | false 67 | Clang_5_0 68 | android-26 69 | 70 | 71 | DynamicLibrary 72 | true 73 | Clang_5_0 74 | android-26 75 | 76 | 77 | DynamicLibrary 78 | false 79 | Clang_5_0 80 | android-26 81 | 82 | 83 | DynamicLibrary 84 | true 85 | Clang_5_0 86 | android-26 87 | 88 | 89 | DynamicLibrary 90 | false 91 | Clang_5_0 92 | android-26 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL\include;..\libsdl\SDL_ttf\include;..\libsdl\SDL_image\include;..\libsdl\SDL_ttf 136 | c++1z 137 | 138 | 139 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 140 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 141 | 142 | 143 | 144 | 145 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL\include;..\libsdl\SDL_ttf\include;..\libsdl\SDL_image\include;..\libsdl\SDL_ttf 146 | c++1z 147 | 148 | 149 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 150 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 151 | 152 | 153 | 154 | 155 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL\include;..\libsdl\SDL_ttf\include;..\libsdl\SDL_image\include;..\libsdl\SDL_ttf 156 | c++1z 157 | 158 | 159 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 160 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 161 | 162 | 163 | 164 | 165 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL\include;..\libsdl\SDL_ttf\include;..\libsdl\SDL_image\include;..\libsdl\SDL_ttf 166 | c++1z 167 | 168 | 169 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 170 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 171 | 172 | 173 | 174 | 175 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL\include;..\libsdl\SDL_ttf\include;..\libsdl\SDL_image\include;..\libsdl\SDL_ttf 176 | c++1z 177 | 178 | 179 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 180 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 181 | 182 | 183 | 184 | 185 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL\include;..\libsdl\SDL_ttf\include;..\libsdl\SDL_image\include;..\libsdl\SDL_ttf 186 | c++1z 187 | 188 | 189 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 190 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 191 | 192 | 193 | 194 | 195 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL\include;..\libsdl\SDL_ttf\include;..\libsdl\SDL_image\include;..\libsdl\SDL_ttf 196 | c++1z 197 | 198 | 199 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 200 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 201 | 202 | 203 | 204 | 205 | $(Sysroot)\usr\include;$(StlIncludeDirectories)%(AdditionalIncludeDirectories);..\libsdl\SDL\include;..\libsdl\SDL_ttf\include;..\libsdl\SDL_image\include;..\libsdl\SDL_ttf 206 | c++1z 207 | 208 | 209 | %(AdditionalLibraryDirectories);$(ToolchainPrebuiltPath)\lib\gcc\$(ToolchainName)\$(ToolchainFullVersionName)\$(PlatformShortName);$(StlLibraryPath);$(SolutionDir)$(Platform)\$(Configuration) 210 | $(StlLibraryName);%(LibraryDependencies);m;dl;GLESv1_CM;GLESv2;log;android;SDL2 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | {b7be417c-b6c5-4a69-a056-e0cb0c6a344c} 220 | 221 | 222 | {03a9401d-ceff-4f5e-a7b4-fc2a0d9f6c95} 223 | 224 | 225 | {8572235c-b335-40dd-ba5f-9954bedc4bfc} 226 | 227 | 228 | 229 | 230 | -------------------------------------------------------------------------------- /main/main.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | SDL2 Template Solution 2 | ---------------------- 3 | 4 | This solution demonstrates how to set up a basic SDL2 project for Android in Visual Studio 2019. The solution is explained in detail on [my blog](http://trederia.blogspot.com/2017/03/building-sdl2-for-android-with-visual.html). 5 | 6 | ## Modifications 2021-4-16 7 | 8 | - Updated to use git submodules for SDL2 (since it has now migrated to git) 9 | 10 | Once you have cloned this repository use `git submodule update --init` to obtain the source of SDL2, SDL_image and SDL_ttf 11 | 12 | ## Modifications 2020-01-15 13 | 14 | - Microsoft Visual Studio 2019 15 | - Fix crash on startup 16 | - add hidapi lib 17 | - fix x86 build 18 | - Merge from from Mercurial > 2.0.11 19 | - remove SDL_Application 20 | - update AndroidManifest 21 | - add free font and label hello world 22 | - switch to c++17 23 | 24 | ## Modifications 2019-09-07 25 | 26 | - Upgraded SDL2 sources to the latest from Mercurial (>2.0.10) 27 | - Added SDL2-image 28 | - Added SDL2-ttf 29 | - Updated compiler and linker flags to be the same for both Debug and Release definitions 30 | 31 | ## Modifications 2019-01-11 32 | 33 | The solution was upgraded to SDL 2.0.9 sources. 34 | 35 | This version of SDL2 depends on Android SDK level 26, which at the time of writing does not ship with the latest Visual Studio. As a result it is currently necessary to reconfigure Visual Studio to use separate installations of Android SDK and NDK. The appropriate setting is found in Visual Studio under Tools > Options > Cross Platform > Android. 36 | 37 | Because newer Android SDKs removed support for the Apache Ant build system, a Gradle project was substituted. The Gradle project is a Visual Studio template and fully supported by Android/VC++. 38 | 39 | — Evan Balster, [imitone](https://imitone.com) project 40 | --------------------------------------------------------------------------------